/flipr

Primary LanguageJavaScript

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.

Table of contents


Auth

Login

Back to top

Login User based on email and password [Generate Tokens]

POST /auth/register/

Request Body

Name Type Description
email String

User Email

password String

User Password

Examples

CURL Example:

curl -X POST -d email=foo[at]bar.com -d password=******

Logout

Back to top

Logout User [Clear Cookie]

POST /auth/logout

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Examples

CURL Example:

curl -X POST --cookie "access_token={access_token}"

Register

Back to top

Register User based on email and password

POST /auth/register/

Request Body

Name Type Description
email String

User Email

password String

User Password

Examples

CURL Example:

curl -X POST -d email=foo[at]bar.com -d password=******

Notes

Create Note

Back to top

Create Note

POST /notes/

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Request Body

Name Type Description
title String

Title for note

tags String

Tags for note

desc String

Description for note

Examples

CURL Example:

curl -X POST --cookie "access_token={access_token} http://localhost:3000/notes -d title=testTitle -d desc=testDesc

Delete Note

Back to top

Delete Note

DELETE /notes/

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Request Body

Name Type Description
id String

id of note to delete

Examples

CURL Example:

curl -X DELETE --cookie "access_token={access_token} http://localhost:3000/notes -d id=200"

Retreive Notes

Back to top

Get All Notes

GET /notes/

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Examples

CURL Example:

curl -X GET --cookie "access_token={access_token} http://localhost:3000/notes"

Retreive Notes by id

Back to top

Get Note by id

GET /notes/:id

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Parameters - Parameter

Name Type Description
id String

Notes ID

Examples

CURL Example:

curl -X GET --cookie "access_token={access_token} http://localhost:3000/notes/200"

Update Note

Back to top

Update Note

PUT /notes/

Header examples

Cookie:

{
  Cookie: access_token={access_token}
}

Request Body

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

Examples

CURL Example:

curl -X PUT --cookie "access_token={access_token} http://localhost:3000/notes -d title=testTitle -d desc=testDesc -d id=200"