nipunravisara / cwb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JWT Authentication

This repository holds jwt token based authentication server written in typescript using node, express and containerized with docker.

Tech

  • NodeJS - JavaScript runtime environment.
  • Express - Web framework for NodeJS.
  • Typescript - Strongly typed programming language.
  • MongoDB - Document-oriented database.
  • Docker - Open source containerization platform.
  • Yup - Schema validation.

Features

  • Request payload validation with yup.
  • Use of express middlewares.
  • Basic CRUD operations.
  • Generate auth token and refresh token.
  • Proper error handling with a seperate module.

Pre configurations

In order for the server to start there are few environment variables that needs to be given via a dotenv file. Create a .env file in the root of the cloned repository and add following environment variables.

  • PORT - Port to run server.
  • DATABASE_URL_DEV - MongoDB Database Connection string.
  • DATABASE - Name of the database.
  • JWT_SECRET_KEY - Jwt secret key.

Installation

Clone repository.

https://github.com/nipunravisara/jwt-auth.git

By default, the Docker will expose port 4000 so change this within the Dockerfile if necessary. When ready, simply use the Dockerfile to build the image. This will create the dillinger image and pull in the necessary dependencies.

docker-compose build

Once done, run the Docker image

docker-compose up

License

MIT

Free Software, Hell Yeah!

About


Languages

Language:TypeScript 98.3%Language:Dockerfile 1.7%