http-server与json-server

http-server is a lightweight nodejs based http server, its biggest advantage is: can make any directory to be the directory server, completely set aside the background of heavy engineering, direct running js code you want.

json-server This module helps you to create back-end REST API interfaces, simply means that CRUD interface, you can quickly create out of the back-end analog implementation, so that the front-end demo in writing when the need to request some interfaces, not need to go write the back-end, data does not need to write the dead, so that front-end developers to spend more time focusing on front-end development to solve the problem.

 

 

http-server

1. Install:
npm i -g http-server
2. Run:
在要成为服务器的目录下运行如下命令http-server

3. To disable caching, use the following command to run

http-server -c-1

json-server

1. Install:
   npm install json-server -g
2. Create a json file:
   In a paper to create a new file folder under db.json

 

   (NewId: 1 may be associated with news array data id 1)

 

   3. Start:

    在当前文件夹下输入如下命令:json-server db.json

   

Guess you like

Origin www.cnblogs.com/cherry14/p/12569406.html