JSON Server - 创建RESTAPI工具


MIT
跨平台
JavaScript

软件简介

JSON Server 用来创建 RestApi,使用非常的方便。

安装

安装之前,需要已经安装好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