Guide for API REST routing for Single Page Applications?

So after starting to feel comfortable in Front End development, I´m starting to play with Full Stack apps after grasping the basics of Node + Express (and a little of Databases too).

The thing is, now I want to do a simple To-Do list on React, but also I want to incorporate a database for it because I want to escale it in the near future to add more funcionality that will require data persitence.

The thing is, I am quite lost in how I should built my back end routes. I want the app to only have 2 possible views. Adding a task, deleting it, and even editing the name of the List i want it to be done in the same page. So i won´t use “/tasks” or “/new/id” but everything will be inside , for example “www.todolist.com/list

Any resource regarding this would be appreciated it (and if its of an app related to a to-do list, even better)

Your typical REST routes are going to look like this (using task as the resource name here)

GET /task        - all tasks.  usually narrowed down with a query string.
POST /task       - create a new task
GET /task/123    - retrieve task 123
PATCH /task/123  - change data in task 123 (sometimes PUT is used instead)
DELETE /task/123 - obvious.

In my own apps, I have my API controllers generate all their routes automatically. Whatever framework you’re using may have something similar. Your REST API routes do not need to look like your front-end routes, BTW.

1 Like

thanks that helps a lot