Miss any of our Open RFC calls?Watch the recordings here! »

express-json-auth

0.0.1 • Public • Published

express-json-auth

Run express basic http auth from a user json file.

npm install express-json-auth --save

Usage example:

user.json

{
    "ted": "123321",
    "bear": "123456"
}

server.js

var app  = require('express')(),
    auth = require('express-json-auth')(); // default path: process cwd dir + user.json
 
// throughout the app
app.use(auth);
 
// through a route
app.get('/admin', auth, function (req, res) {
    res.send('Logged!');
});

Specific json

...
auth = require('express-json-auth')('./private/admin.json');
...

Object

...
users = {
    "ted": "123321",
    "bear": "123456"
},
auth  = require('express-json-auth').plain(users);
...

Release notes

  • 0.0.1 - First release - Basic auth from a json

License

MIT License (c) Helder Santana

Keywords

none

Install

npm i express-json-auth

DownloadsWeekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • avatar