@ryanburnette/basic-http-auth
v1.1.0
Published
Basic HTTP authentication middleware for Express.
Downloads
4
Readme
@ryanburnette/basic-http-auth
Basic HTTP authentication middleware for Express.
Usage Example
'use strict';
var express = require('express');
var auth = require('@ryanburnette/basic-http-auth');
var app = express();
var authorize = auth({
users: [
{
username: 'brian',
password: 'foo'
},
{
username: 'stewie',
password: 'bar'
}
],
realm: 'my realm',
conditions: function (req,res) {
if (req.path.includes('foo')) return false;
return true;
}
});
app.get('/', authorize, (req,res) => res.sendStatus(200));
app.listen(3000,() => console.log('listening'));