Skip to content

A basic template for a server token authorization

License

Notifications You must be signed in to change notification settings

eperezcosano/auth-server-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Server JWT Auth

A basic template for a server token authorization

Models

User

Parameter Type Description
email string User e-mail
pass string User password

Routes

Method Auth Path Description Body JSON
GET / "Hello World"
POST /register Create a new user User
POST /login Generates a new JWT User
GET JWT /validate Validate JWT
GET JWT /dashboard/ Protected route
GET JWT /dashboard/users Get all users

Installation

Install dependencies:

npm i

Add .env file:

MONGO_URI=<mongo uri string>
PORT=<server port listening>
JW_SECRET=<json web token secret>
JW_EXPIRATION=<in seconds>

Run node project:

node index.js

Technologies

  • node.js
  • express
  • mongoose
  • jwt

Author Info

Izan Pérez Cosano (https://github.com/eperezcosano)

Releases

No releases published

Packages

No packages published