Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Azzarox authored Apr 24, 2023
1 parent b7952f2 commit 11c2565
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The REST Api is deployed at: https://todo-mern-app-juco.onrender.com.

Upon clicking the link to the server it should open documentation of the api done with Swagger. Thus you can try out the endpoints. However, you can use the below information. It should be sufficient for the overview of the api.
Upon clicking the link to the server it should open documentation of the api done with Swagger thus you can try out the endpoints. However, you can use the below information which should be sufficient enough for general overview of the api.


| Method | Route | Body | Requirements | Responses | Information |
Expand All @@ -13,7 +13,7 @@ Upon clicking the link to the server it should open documentation of the api don
| POST | `/api/auth/login` | { "username":"exampleuser", "password": "examplepassword"} | N/A | `200 OK`: Returns a JWT Token <br> `400 Bad Request`: Returns message with the error's message | Authenticates the user |
| GET | `/api/todos` | N/A | Authorization header in the format `Bearer <token>` | `200 OK`: Returns a list of the currently logged user's todos <br> `401 Unauthorized` | Queries all the todos. By default its all recent ones. |
| POST | `/api/todos` | { "title":"sometitle", "description":"somedescription" } | Authorization header in the format `Bearer <token>` | `201 Created` Returns the created todo object <br> `401 Unauthorized` | Creates todo and automatically adds the user as author |
| GET | `/api/todos?filter= ` | N/A | Authorization header in the format `Bearer <token>` | `200 OK`: Returns the logged user's todos by filter <br> `401 Unauthorized` | Returns the user's todos set by querystring with _filter_. Choices are `incomplete`, `complete` or `recent`. Defaults to _recent_ |
| GET | `/api/todos?filter=` | N/A | Authorization header in the format `Bearer <token>` | `200 OK`: Returns the logged user's todos by filter <br> `401 Unauthorized` | Returns the user's todos set by querystring with _filter_. Choices are `incomplete`, `complete` or `recent`. Defaults to _recent_ |
| GET | `/api/todos?filter=&title=` | N/A | Authorization header in the format `Bearer <token>` | `200 OK`: Returns the logged user's todos by filter and title <br> `401 Unauthorized` | Returns the user's todos set by querystring with _filter_ and _title_. For the filter the choices are the same as above. Defaults to _recent_. For the title it could be anything. |
| PUT | `/api/todos/:id` | { "isDone": "true"} | Authorization header in the format `Bearer <token>` and the **id** of the todo in the URL path | `200 OK`: Returns the todo object and and isDone value set as true <br> `400 Bad Request` <br> `401 Unauthorized` | Updates the todo and makes it completed by changing the isDone value to true |
| DELETE | `/api/todos/:id` | N/A | Authorization header in the format `Bearer <token>` and the **id** of the todo in the URL path | `200 OK`: Returns the deleted todo object <br> `400 Bad Request` <br> `401 Unauthorized` | Deletes the todo and returns the deleted todo object |
Expand Down

0 comments on commit 11c2565

Please sign in to comment.