express-simple-basic-auth

1.0.2 • Public • Published

express-simple-basic-auth

Simple Basic authorization middleware for Express

Fetures

  • Promise based
  • Database ready

Usage

npm install --save express-simple-basic-auth

Using yarn is even better

const express = require('express');
const basicAuth = require('express-simple-basic-auth');
 
const app = express();
app.use(basicAuth({
  find(username, password) {
    return db.collection('users').findOne({ username, password });
  }
  // or
  find(username) {
    return db.collection('users').findOne({ username, password }).then(user => user && ({ [user.username]: user.password }));
  }
});

Readme

Keywords

none

Package Sidebar

Install

npm i express-simple-basic-auth

Weekly Downloads

4

Version

1.0.2

License

MIT

Last publish

Collaborators

  • iddan