Skip to content

heldr/express-json-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-json-auth

Run Express basic http auth from a user json file. Inspired by apache .htpasswd files :)

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

About

Run Express basic http auth from a user json file. Inspired by apache .htpasswd files :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published