Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.43 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.43 KB

api spec

生成されるドキュメント

record10

開発サーバーを立ててリクエストする例

record10

spec

  • node_version: v8.1.2
  • yarn v1.3.2

install

$ cd /path/to/this/
$ yarn

書き方

  • api blue print の形式で書いてください。
  • 書き終わったら以下のコマンドを実行し、 index.html を生成してください。
$ yarn run build
$ open index.html

mock サーバーの立ち上げ

mock server を立ち上げることで、 api サーバーが完成する前に、json のやりとりができます。

$ yarn run dev_server

localhost:3002 番にサーバーが立ち上がるように設定しています。

リクエスト例

POST: /items
curl -H "Content-Type: application/json" -X POST -d '{"title":"カバン"}' http://localhost:3002/items/

GET: /items
curl -H "Content-Type: application/json" -X GET http://localhost:3002/items

PUT: /items/1
curl -H "Content-Type: application/json" -X PUT -d '{"title": "綺麗なカバン"}' http://localhost:3002/items/1

参考資料