Configuring the router

When you design the routes for a web application, you should think about all the features that the application should provide to the user and map these features to an HTTP request.

In our example app, the user will need to load the homepage, get a list of all existing notes, create a new note, update a note's position, and delete a note. What we should do now is create an API for our app, which creates a route for all of these actions. I've personally organized it with the following routes:

  • get (/: This route gets called when the user visits the app's homepage from his browser and is responsible for rendering the view to the screen
  • get (/notes: This route allows us to request a list of all existing notes that are stored in ...

Get Getting Started with RethinkDB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.