server json
json-server --watch db.json
Disgusted Dragonfly
json-server --watch db.json
npm install -g json-server
npm i --save-dev json-server
<add db.json file>
npx json-server --watch db.json
# to change port
npx json-server --watch db.json --port 8000
npm install -g json-server
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}
const myObj = {name: "John", age: 31, city: "New York"};
const myJSON = JSON.stringify(myObj);
window.location = "demo_json.php?x=" + myJSON;