Как запустить json server
json-server --watch db.json
Disgusted Dragonfly
json-server --watch db.json
json-server --watch db.json
npm install -g json-server
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
[
{
"id": 1,
"title": "json-server",
"author": "typicode"
}
]
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)