Categorygithub.com/AloisCRR/jwt-api-notes
modulepackage
0.0.0-20210516165035-e963ebd9a59a
Repository: https://github.com/aloiscrr/jwt-api-notes.git
Documentation: pkg.go.dev

# README

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
BodyTypeDescription
emailstringRequired. User email address
passwordstringRequired. Account password
ResponseTypeDescription
messagestringAPI message
statusnumberHTTP status code
tokenstringAuth token to access protected routes

Sign in or login

POST /login
BodyTypeDescription
emailstringRequired. User email address
passwordstringRequired. Account password
ResponseTypeDescription
messagestringAPI message
statusnumberHTTP status code
tokenBearer tokenAuth token to access protected routes

Note creation

POST /notes
HeadersTypeDescription
AuthenticationBearer tokenRequired. Jwt given on sign in or sign up
BodyTypeDescription
titlestringRequired. Note title
contentstringNote content
ResponseTypeDescription
messagestringAPI message
statusnumberHTTP status code

Get all notes

GET /notes
HeadersTypeDescription
AuthenticationBearer tokenRequired. Jwt given on sign in or sign up
ResponseTypeDescription
dataNote[]API message
messagestringAPI message
statusnumberHTTP status code

Note update

PUT /notes/${id}
ParameterTypeDescription
idstringRequired. Note ID
HeadersTypeDescription
AuthenticationBearer tokenRequired. Jwt given on sign in or sign up
ResponseTypeDescription
messagestringAPI message
statusnumberHTTP status code

Get single note

GET /notes/${id}
ParameterTypeDescription
idstringRequired. Note ID
HeadersTypeDescription
AuthenticationBearer tokenRequired. Jwt given on sign in or sign up
ResponseTypeDescription
dataNoteAPI message
messagestringAPI message
statusnumberHTTP status code

Delete note

DELETE /notes/${id}
ParameterTypeDescription
idstringRequired. Note ID
HeadersTypeDescription
AuthenticationBearer tokenRequired. Jwt given on sign in or sign up
ResponseTypeDescription
messagestringAPI message
statusnumberHTTP 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

NameDescription
MongoDBDatabase
GinHTTP Server
jwt-goLibrary to generate, parse, validate and more JWTs
validatorInput validation
BcryptAlgorithm used to hash passwords.

Roadmap

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

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author