jup-auth-handler
jup-auth-handler is a promise-based Node.js auth handler for MySQL using ORM Sequelize. Provides basic auth functions
Installation
$ npm i jup-auth-handler --save
Usage
You can use both ES6 or ES5 syntax to use the package
$ // Or you can use es5 Syntax$ const auth userControllers runMigrations = ; //es5 syntax // in your main.js use following to run all the migrations once the server gets started; // for ACL useapp; // will protect routes as per permissions // using for loginapp; //using for protected routesapp
Create a .env
file in the root directory of your project. Add
environment-specific variables on new lines in the form of NAME=VALUE
. and load it in Node enviroment
Required ENV variables
#update the variables values with actual ones MYSQL_USER=rootMYSQL_PASSWORD=rootMYSQL_DATABASE=jupiterMYSQL_HOST=localMYSQL_PORT=3606expiry_time = 36000 # jwt token expiry time in miliseconds SECRET_KEY_JWT = xyz #your secret JWT key NO_REPLY_EMAIL = adnanshuja3@gmail.com # your email NO_REPLY_PASSWORD = yourpassword #to send email to user [password reset, signup etc]
Tests
$ npm run test // run tests in package directory