🔷 Json Server

https://github.com/typicode/json-server

npm: json-server

JSON Server는 테스트를 하거나 프로토타이핑을 할 때 REST API 서버를 간단히 생성해주는 라이브러리 입니다.

∴ REST API

put 과 patch

🔹 json-server 설치

npm install json-server    # 의존성 추가
npm install -d json-server # 개발전용 dev
npm install -g json-server # 전역에 설치 global

image.png

🔹 json-server 실행

🔹 db.json 생성

{
  "posts": [
    { "id": "1", "title": "a title", "views": 100 },
    { "id": "2", "title": "another title", "views": 200 }
  ],
  "comments": [
    { "id": "1", "text": "a comment about post 1", "postId": "1" },
    { "id": "2", "text": "another comment about post 1", "postId": "1" }
  ],
  "profile": {
    "name": "typicode"
  }
}

image.png