Note: The RESTful routes also apply to RESTful APIs, however JSON is returned to the client vs. HTML
HTTP Verb | Path (endpoint) | controller#action | View to Render or Redirect |
Purpose |
---|---|---|---|---|
GET | /posts | posts#index | index | List all posts |
GET | /posts/:id | posts#show | show | Show a single post |
POST | /posts | posts#create | redirect | Create a new post |
PUT | /posts/:id | posts#update | redirect | Update a post |
DELETE | /posts/:id | posts#destroy | redirect | Delete a post |
HTTP Verb | Path (endpoint) | controller#action | Default View or Redirect |
Purpose |
---|---|---|---|---|
GET | /posts/new | posts#new | new | Provide form for submitting new post to the create action |
GET | /posts/:id/edit | posts#edit | edit | Provide form for editing a post and sending to the update action |