JSON Server創(chuàng)建RESTAPI工具
JSON Server 用來創(chuàng)建 RestApi,使用非常的方便。
安裝
安裝之前,需要已經(jīng)安裝好NodeJs.
$ sudo npm install -g json-server
基本使用
新建一個db.json文件寫入一段json,如:
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
啟動server
json-server --watch db.json
評論
圖片
表情
