# Install JSON Server Globally
npm install -g json-server
# #Install JSON Server Locally
npm install json-server
# Check JSON Server version
json-server --version
# Run JSON server
json-server --watch db.json
# Change the server PORT
json-server --watch db.json --port 4000
const jsonServer = require('json-server')
const server = jsonServer.create()
const router = jsonServer.router('db.json')
const middlewares = jsonServer.defaults()
const port = process.env.PORT || 3000
server.use(middlewares)
server.use(router)
server.listen(port)