https://github.com/typicode/json-server
JSON Server는 테스트를 하거나 프로토타이핑을 할 때 REST API 서버를 간단히 생성해주는 라이브러리 입니다.
HTTP 메서드와 같이 쓰임
GET /posts - 목록 조회
GET /posts/:id - 한 건 조회
POST /posts - 등록
PUT /posts/:id - 전체 데이터 수정
PATCH /posts/:id - 일부 데이터 수정
DELETE /posts/:id - 한 건 데이터 삭제
요청 후 끊김
단방향 통신
npm install json-server # 의존성 추가
npm install -d json-server # 개발전용 dev
npm install -g json-server # 전역에 설치 global
{
"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"
}
}