목록Mongoose (4)
taenyLog
post 요청을 받았을때 req.body 접근위해 아래와 같은 코드를 index.js파일에 넣어준다. // 우리가 post 요청을 받으면 그 body의 정보가 필요로 하지만 req.body로 바로 접근 불가 // 할 순 있지만 Undefined 값을 갖는다 .파싱되지않는값 // Express가 미들웨어를 사용하도록 명령해야함. app.use(express.urlencoded({ extended: true })); html Product Name Price (Unit) Select Category Submit
res.send The res.send() function basically sends the HTTP response. The body parameter can be a String or a Buffer object or an object or an Array. Syntax: res.send( [body] ) Parameter: This function accepts a single parameter body that describes the body which is to be sent in the response. Returns: It returns an Object. res.render The res.render() function is used to render a view and sends th..

최신버전의 Node.js 사용하는 경우 JS파일에서 몽구스 모듈을 가져오고 강의 코드를 실행할때 .load index.js 명령 대신 node -i -e "$(< index.js)" 명령사용하자. 윈도우라면 깃배쉬 이용 .
schema(스키마)는 Mongo의 각기 다른 키 집합을 JavaScript의 다른 타입으로 구조를 짜는 것을 말한다. JS나 기타 언어에서 다른 타입인 데이터를 Mongo로부터 가져오지만 그 언어에 데이터 타입이 있을 수도 있고 없을 수도 있다. 스키마를 정의함으로써 구체화한다. https://mongoosejs.com/docs/guide.html Mongoose v7.3.1: Schemas If you haven't yet done so, please take a minute to read the quickstart to get an idea of how Mongoose works. If you are migrating from 6.x to 7.x please take a moment to read ..