REST API とは
1 情報の操作は全てHTTPメソッド(CRUD処理)で行われる。
| CRUD 処理の種類 | controller_methods |
|---|---|
| Create | Create |
| Read | indexとshow |
| Update | update |
| Delete | destroy |
2 URI(URL)を読むだけで『何のリソース』に『 どのような処理』をするのかわかる。
ここではURLはarticlesにする
『何のリソース』は/articlesかarticles/:id
どのような処理はHTTP method
| CRUD 処理の種類 | HTTP method | URL Pattern | controller_methods |
|---|---|---|---|
| Create | POST | POST /articles | create |
| Read | GET | GET /articles | index |
| Read | GET | GET /articles/:id | show |
| Update | PUT PATCH | PUT or PATCH/articles/:id | update |
| Delete | DELETE | DELETE/articles/:id | destroy |
有益な動画