A TODO has the following fields:
- title: string type
- content: string type
- createdAt: date type (automatically calculated in the backend)
- _id: mongo object id
-
POST
/api/todosRequest body should have the fields: title, content -
GET
/api/todos?limit=50&offset=0By passing limit and offset in the url, you can control how many todos to return. If no params are passed, 10 todos are returned by default. -
GET
/api/todos/{id}Fetches a todo with the given object id. For example, a GET request onapi/todos/1will return the todo with_id = 1 -
PUT
/api/todos/{id}Updates a todo with the given object id. For example, a PUT request onapi/todos/1will update the todo with_id = 1 -
DELETE
/api/todos/{id}Deletes a todo with the given object id. For example, a DELETE request onapi/todos/1will delete the todo with_id = 1
The first 3 steps below are to set the project up in your local environment, which is to be done just once at the beggining.
Cloning the repository
Creating a .env file with the same fields as mentioned in the .env.example file
Installing node packages using the command npm i
Running the backend server using the command npm start.