- Node v18.16.0
- MongoDB
- Node v18.16.0
- Express
- Mongoose
- JWT
- MongoDB
- Create a new mongodb database
- Run
npm install
. - Run
npm start
to start the server.
- You need to add the following environment variables on .env file:
- MONGO_DB_URL
- JWT_SECRET
- Endpoint:
/api/v1/auth/sign_in
- Method: POST
- Description: User sign in.
- Request:
- Body: JWT Token
- Response:
- Status Code: 201 (Created)
- JWT Token
- Endpoint:
/api/v1/auth/register
- Method: POST
- Description: User registration.
- Request:
- Body: User object
- Response:
- Status Code: 201 (Created)
- Created user object
- Endpoint:
/api/v1/profile
- Method: GET
- Description: Get user profile.
- Response:
- Status Code: 200 (OK)
- Body: User object
- Endpoint:
/api/v1/todos
- Method: GET
- Description: Retrieve all todos by logged in user.
- Response:
- Status Code: 200 (OK)
- Body: Array of todos
- Endpoint:
/api/v1/todos/:id
- Method: GET
- Description: Retrieve a specific todo by ID.
- Parameters:
id
(string) - ID of the todo.
- Response:
- Status Code: 200 (OK)
- Body: Todo object
- Endpoint:
/api/v1/todos
- Method: POST
- Description: Create a new todo.
- Request:
- Body: Todo object
- Response:
- Status Code: 201 (Created)
- Body: Created todo object
- Endpoint:
/api/v1/todos/:id
- Method: PUT
- Description: Update a specific todo by ID.
- Parameters:
id
(string) - ID of the todo.
- Request:
- Body: Updated todo object
- Response:
- Status Code: 200 (OK)
- Body: Updated todo object
- Endpoint:
/api/v1/todos/:id
- Method: DELETE
- Description: Delete a specific todo by ID.
- Parameters:
id
(string) - ID of the todo.
- Response:
- Status Code: 200 (OK)
- Body: Soft deleted todo object