API to save user notes, implementing JWT for auth and MongoDB as database.
-
Install both:
You will need to have MongoDB running on port 27017.
-
Clone the project:
git clone https://github.com/AloisCRR/jwt-api-notes.git
-
Go to the project directory:
-
Install dependencies:
-
Start the server:
REST API will run in http://localhost:8080.
| Body |
Type |
Description |
email |
string |
Required. User email address |
password |
string |
Required. Account password |
| Response |
Type |
Description |
message |
string |
API message |
status |
number |
HTTP status code |
token |
string |
Auth token to access protected routes |
| Body |
Type |
Description |
email |
string |
Required. User email address |
password |
string |
Required. Account password |
| Response |
Type |
Description |
message |
string |
API message |
status |
number |
HTTP status code |
token |
Bearer token |
Auth token to access protected routes |
| Headers |
Type |
Description |
Authentication |
Bearer token |
Required. Jwt given on sign in or sign up |
| Body |
Type |
Description |
title |
string |
Required. Note title |
content |
string |
Note content |
| Response |
Type |
Description |
message |
string |
API message |
status |
number |
HTTP status code |
| Headers |
Type |
Description |
Authentication |
Bearer token |
Required. Jwt given on sign in or sign up |
| Response |
Type |
Description |
data |
Note[] |
API message |
message |
string |
API message |
status |
number |
HTTP status code |
| Parameter |
Type |
Description |
id |
string |
Required. Note ID |
| Headers |
Type |
Description |
Authentication |
Bearer token |
Required. Jwt given on sign in or sign up |
| Response |
Type |
Description |
message |
string |
API message |
status |
number |
HTTP status code |
| Parameter |
Type |
Description |
id |
string |
Required. Note ID |
| Headers |
Type |
Description |
Authentication |
Bearer token |
Required. Jwt given on sign in or sign up |
| Response |
Type |
Description |
data |
Note |
API message |
message |
string |
API message |
status |
number |
HTTP status code |
| Parameter |
Type |
Description |
id |
string |
Required. Note ID |
| Headers |
Type |
Description |
Authentication |
Bearer token |
Required. Jwt given on sign in or sign up |
| Response |
Type |
Description |
message |
string |
API message |
status |
number |
HTTP status code |
No token provided

Basic input validation

Sign up or register

Sign in or login

Note creation

All notes

Note update

Get single note

Delete note

| Name |
Description |
| MongoDB |
Database |
| Gin |
HTTP Server |
| jwt-go |
Library to generate, parse, validate and more JWTs |
| validator |
Input validation |
| Bcrypt |
Algorithm used to hash passwords. |