Skip to content

Instantly share code, notes, and snippets.

@hackugyo
Created November 27, 2015 05:25
Show Gist options
  • Select an option

  • Save hackugyo/09cb358bca437f0788a2 to your computer and use it in GitHub Desktop.

Select an option

Save hackugyo/09cb358bca437f0788a2 to your computer and use it in GitHub Desktop.
$ json-server --watch db.json
http://qiita.com/yhikishima/items/46860ffc48913182a3ee
# ルーティングのためのキーが必要になる。listというところを空にするとオチる
$ json-server --watch db.json # 起動
$ http -v POST localhost:3000/list < ~/git/json_server/data.json # data.jsonをPOST
# POSTするとモックJSONサーバの内部状態が変化する
{
"name": "fuga"
}
{
"list": [
{
"id": 1,
"name": "yamada",
"gender": "M"
},
{
"id": 2,
"name": "satou",
"gender": "W"
},
{
"id": 3,
"name": "tanaka",
"gender": "M"
},
{
"id": 4
},
{
"name": "fuga",
"id": 5
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment