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 screenget (/notes
: This route allows us to request a list of all existing notes that are stored in the databasepost (/notes
: This route is called when the user creates a new notepost (/note/:id
: When the user moves a note, a request to this route is performed, passing the note's IDdelete (/note/id
: Finally, this route allows us to delete a specific...