NOTES REST Api
Use .env.example
as reference to create a .env
file in the backend
folder. And simply run docker compose up
to start the database, backend server, and mongo-express server.
Login User based on email and password [Generate Tokens]
POST /auth/register/
Name | Type | Description |
---|---|---|
String |
User Email |
|
password | String |
User Password |
CURL Example:
curl -X POST -d email=foo[at]bar.com -d password=******
Logout User [Clear Cookie]
POST /auth/logout
Cookie:
{
Cookie: access_token={access_token}
}
CURL Example:
curl -X POST --cookie "access_token={access_token}"
Register User based on email and password
POST /auth/register/
Name | Type | Description |
---|---|---|
String |
User Email |
|
password | String |
User Password |
CURL Example:
curl -X POST -d email=foo[at]bar.com -d password=******
Create Note
POST /notes/
Cookie:
{
Cookie: access_token={access_token}
}
Name | Type | Description |
---|---|---|
title | String |
Title for note |
tags | String |
Tags for note |
desc | String |
Description for note |
CURL Example:
curl -X POST --cookie "access_token={access_token} http://localhost:3000/notes -d title=testTitle -d desc=testDesc
Delete Note
DELETE /notes/
Cookie:
{
Cookie: access_token={access_token}
}
Name | Type | Description |
---|---|---|
id | String |
id of note to delete |
CURL Example:
curl -X DELETE --cookie "access_token={access_token} http://localhost:3000/notes -d id=200"
Get All Notes
GET /notes/
Cookie:
{
Cookie: access_token={access_token}
}
CURL Example:
curl -X GET --cookie "access_token={access_token} http://localhost:3000/notes"
Get Note by id
GET /notes/:id
Cookie:
{
Cookie: access_token={access_token}
}
Name | Type | Description |
---|---|---|
id | String |
Notes ID |
CURL Example:
curl -X GET --cookie "access_token={access_token} http://localhost:3000/notes/200"
Update Note
PUT /notes/
Cookie:
{
Cookie: access_token={access_token}
}
Name | Type | Description |
---|---|---|
title | String |
Title for updated note |
tags | String |
Tags for updated note |
desc | String |
Description for updated note |
id | String |
id of note to update |
CURL Example:
curl -X PUT --cookie "access_token={access_token} http://localhost:3000/notes -d title=testTitle -d desc=testDesc -d id=200"