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
$ import { auth, userControllers, runMigrations } from 'jup-auth-handler'
$ const { auth, userControllers, runMigrations } = require('jup-auth-handler');
runMigrations();
app.use(auth.setAccessControl());
app.post('/login', auth.authenticateUser, userControllers.createUser);
app.post('/protected-route', auth.verifyUser, yourController)
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
MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=jupiter
MYSQL_HOST=local
MYSQL_PORT=3606
expiry_time = 36000
SECRET_KEY_JWT = xyz
NO_REPLY_EMAIL = adnanshuja3@gmail.com
NO_REPLY_PASSWORD = yourpassword
Tests
$ npm run test