This package has been deprecated

Author message:

WARNING: This project has been renamed to express-auth-box. Install using express-auth-box instead.

express_auth_box

0.0.2 • Public • Published

Express Auth In A Box

Introduction

Don't ever use this in production. It is strictly for dictactic/research purposes.

Just:

  • init an express app
  • npm i express_auth_box
  • const { handler } = require('express_auth_box')
  • and mount the handler as middleware: app.use(handler

Out of the box(!) you get /auth/login/, /auth/register/, and /auth/verify/ routes!

Yay!

Example

Here is an example server app with both public and private routes:

const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const logger = require("morgan");
const app = express();
 
const { handler, restrict } = require('./box_auth');
 
app.use(logger('dev'));
app.use(cors());
app.use(bodyParser.json());
 
const router = express.Router();
router.get('/foo', (req, res) => res.json('ok'));
router.use(handler);
router.get('/secret', restrict, (req, res) => res.send('the answer is 42'));
 
app.use('/api', router);
 
module.exports = {
  app,
};

Readme

Keywords

none

Package Sidebar

Install

npm i express_auth_box

Weekly Downloads

0

Version

0.0.2

License

ISC

Unpacked Size

12.8 kB

Total Files

9

Last publish

Collaborators

  • axylos