AloisCRR / jwt-api-notes

A Golang-made web application to take notes, implementing JWT for auth and MongoDB for save data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notes API

API to save user notes, implementing JWT for auth and MongoDB as database.

Run Locally

  1. Install both:

    You will need to have MongoDB running on port 27017.

  2. Clone the project:

    git clone https://github.com/AloisCRR/jwt-api-notes.git
  3. Go to the project directory:

    cd jwt-api-notes
  4. Install dependencies:

    go mod tidy
  5. Start the server:

    go run main.go

    REST API will run in http://localhost:8080.

API Reference

Note

Note entity

Signup or register

POST /signup
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

Sign in or login

POST /login
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

Note creation

POST /notes
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

Get all notes

GET /notes
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

Note update

PUT /notes/${id}
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

Get single note

GET /notes/${id}
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

Delete note

DELETE /notes/${id}
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

Screenshots

No token provided

No token

Basic input validation

Input validation

Sign up or register

Register

Sign in or login

Login

Note creation

Login

All notes

Login

Note update

Login

Get single note

Login

Delete note

Login

Tech Stack

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.

Roadmap

  • App functionality
  • Testing
  • Hosting, domain, etc.
  • CI/CD

About

A Golang-made web application to take notes, implementing JWT for auth and MongoDB for save data.


Languages

Language:Go 100.0%