BassemMamar / json-server-example

A quick example for how to use json-server and make a fake server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json-server Example

With json-server you can simply make a mock server with any json file you want and start test your front end quickly.

Example Usage

Command line:

npm run json:server hosts the db.json file in the port 3000, you jsut go to http://localhost:3000/

npm run json:server:random hosts random data generated by executing generator.js script and host it in the port 3004, you jsut go to http://localhost:3004/

Installation

Just install json-server package and that's it

npm install json-server

OR

npm install 

For use on the command line, use the flag npm install json-server -g.

Note

  • As a benifit i recommend to install json-server globally, then you can run the command json-server --watch <data-json-file-name>.json in any repository that contains your json data and have a server ready to use.

  • For generating a dummy json data you may use

About

A quick example for how to use json-server and make a fake server


Languages

Language:JavaScript 100.0%