Contents

JSON Server - Get a full fake REST API with zero coding in less than 30 seconds

Contents

JSON Server
https://github.com/typicode/json-server
Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Created with <3 for front-end developers who need a quick back-end for prototyping and mocking.

Example

Create a db.json file

{
“posts”: [
{ “id”: 1, “title”: “json-server”, “author”: “typicode” }
],
“comments”: [
{ “id”: 1, “body”: “some comment”, “postId”: 1 }
],
“profile”: { “name”: “typicode” }
}

Start JSON Server

$ json-server --watch db.json

Now if you go to http://localhost:3000/posts/1, you’ll get

{ “id”: 1, “title”: “json-server”, “author”: “typicode” }


Source: commit d633c64 in My-Notes.