Coder Social home page Coder Social logo

jwt-2-cookie-auth's Introduction

Managing JSON Web Tokens (JWT) with 2 Cookie Auth

In this example application, we use 2 cookies in the browser to manage the transmission, validation, and expiration of our JSON Web Token (JWT).

Tutorial Available

YouTube: JWT | 2 Cookie Auth

JWT | 2 Cookie Auth)

Running the Server

With NodeJS installed, you can started the server by running,

node app.js

OR

npm run start

Development

This simple server can be easily extended. After cloning this repository you can start developing locally.

Locally (without Docker)

  1. Install Nodemon, Nodemon will watch for file changes and restart the NodeJS process. This allows for faster development and testing.
npm install -g nodemon
  1. With Nodemon installed, start the server using Nodemon
nodemon app.js

OR

npm run start:dev

Using Docker

I prefer to use Docker for local development wherever possible. This allows me to have a consistent development environment.

Start Docker Container

With Docker installed, we can start a container using the latest NodeJS Docker image.

docker run -it --rm -p 8080:8080 -v $(pwd):/api -w="/api" node bash

Start the application in development mode using Nodemon inside your Docker Container

npm run start:dev

To stop your running NodeJS API server

ctrl + c

To quit your Docker Container development environment, in your terminal:

exit

This will cleanup any running containers, (note: the Docker image will still exist on your machine)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.