Mongoose 썸네일형 리스트형 Express를 이용한 MongoDB RESTful API 서버 만들기 준비 사항 - MongoDB 설치, 서버 가동 - MongoDB GUI Tool - Robo 3T 설치 Http 메소드와 Endpoint에 따른 요청을 정리하면 다음과 같다. HTTP Methods /articles /articles/sports GET Fetches all the articles Fetches the article on sports POST Creates one new article - PUT - Updates the article on sports PATCH - Updates the article on sports DELETE Deletes all the articles Deletes the article on sports 1. 기본 프로젝트 세팅 const express = requ.. 더보기 Mongoose 사용법 -Node에서 mongoDB 연결 + CRUD - MongoDB 구조 : Database > Collection > Document Node에서 MongoDB를 사용하는 방법은 여러가지가 있다. MongoDB에서 자체적으로 제공하는 Driver를 사용해도 되지만 Mongoose를 사용하는 것이 훨씬 간편하다. Moogoose API Docs를 참고하여 작성하였다. 1. mongoose 모듈 가져오기, Node앱을 MongoDB에 연결하기 const mongoose = require("mongoose"); // mongodb://[URL of MongoDB server]/[Name of DB to connect(make one if doesn't exist)] mongoose.connect("mongodb://localhost:27017/fruitsD.. 더보기 이전 1 다음