The router is going to be a map of each of the available URL paths for the app. Every route on the server will correspond to a function in a controller. Here is what our routes table will look like for the particular application we are writing:
GET /(index) - home.index (render the homepage of the site) GET /images/image_id - image.index (render the page for a specific image) POST /images - image.create (when a user submits and uploads a new image) POST /images/image_id/like - image.like (when a user clicks the Like button) POST /images/image_id/comment - image.comment (when a user posts a comment)
You can see that we are handling two different
GET requests and three different
POST requests. In addition, we have two main controllers:
image. Controllers are really...