본문 바로가기

전체 글

(68)
routing _express docs _express 안내서에 나온순서대로 정리하며 넘어가려 합니다. 라우팅 : 어떤 경로나 특정 HTTP 요청에 대해 무슨 응답을 할지 결정하는 것입니다. app.get('/', function (req, res) { res.send('Hello World!'); }); 위 코드를 보면, 'get'은 http 요청 | '/' 은 서버에서의 경로 | function(req, res){}; 는 경로가 일치할때 실행할 콜백/함수입니다. 라우트(루트) '/' 에 대한 get 요청에 대한 응답은 "function(req, res) {}; "이라고 생각하면 됩니다. express에서 라우터를 이용할 때는 express 인스턴스와 연결시켜야 합니다. var express = require('express'); var a..
mongoose ODM : Object Document Mapping : 객체와 문서의 매핑. Object는 JS의 객체, Document는 MongoDB의 문서 => 문서를 DB에서 조회할 때 자바스크립트 객체로 바꿔주는 역할. mongoos의 장점 : - Schema 이용. - populate - Promise / Callback - easy~ Query builder Schema 몽구스는 사용자가 작성한 스키마를 기준으로 데이터를 DB에 넣기 전에 먼저 검사합니다. 스키마에 어긋나면 에러를 발생시킵니다. Schema.protytype.pre() 'pre()' 메서드는 지정된 메서드 전에 원하는 작업을 진행하게 만든다. var toySchema = new Schema({ name: String, created: Da..
How you are getting hired. https://sivers.org/gethired How to get hired | Derek Sivers In my 15 years running two companies and two bands, I’ve employed about 100 people. sivers.org life is attainable/ winning First, choose the company where you wanna work really. Second, contact them. right now. Polite manners don’t prove passion. Do this until hired Eventually they will be hiring, and they’d be damn foolish not to hire ..
execPopulate() /mongoose. Document.prototype.execPopulate() Parameters [callback] «Function» optional callback. If specified, a promise will not be returned Returns: «Promise» promise that resolves to the document when population is done Explicitly executes population and returns a promise. Useful for ES2015 integration. Example: const promise = doc.execPopulate({ path: 'company', select: 'employees' }); // summary promi..
payload payload ? HTTP 요청을 보낼 때, 포함되는 데이터를 payload라고 합니다. payload는 JSON 형태를 가지고 있으며 JSON을 구성하는 키는 파라미터 이름이고, 값은 추출된 값이 됩니다. HTTP 요청에 대한 응답도 JSON의 형태를 갖고 출력 영역으로 전달되고 사용되어 질 수 있습니다. 'Payload'는 파라미터들이 'key value' 형태로 JSON을 기본 구성하고 여기에 'user request'의 일부 항목과 누적된 컨텍스트 정보입니다. "https://i.kakao.com/docs/key-concepts-parameters#request-payload-%EA%B5%AC%EC%84%B1" 단순히 전송되는 데이터라고 생각하면 된다.
Prifiles for Users /node User profiles is a common requirement for web applications and seem relatively straightforward - just send back the data from our user model via an endpoint. but there is some problem which has sensitive data like the user's email, password, and a JWT token. To keep these sensitive datas, we'll need to create a method on the User model that will output a version of the user's information that is..
Postman How to set Query Parameters first is appending the query string to the end of the URL. second is Clicking the Params button to the left of the URL field, which will presents additional text fields under URL field to enter query parameters in key-value pais. Use a query parameter to filter articles on Conduit by tag. request method is 'GET' and the request URL is 'https://conduit.productionready...
node / express 공부기. "뭘 해야할까?" "보편적인 express 구조부터 파악해야겠다." 검색 키워드: "best express portfolio" / "best node api portfolio" => https://www.tutorialspoint.com/expressjs/expressjs_best_practices.htm 들어가니 대중적인 구조가 떡하니 있었다. 흠. 잘모르겠다. "실제 예제 코드를 보면서 코드부터 익숙해져야겠다." https://thinkster.io/tutorials/fullstack Mastering Fullstack Development: Learn How to Build Modern Web Apps - Thinkster Learn how to build a real world fullstack ..