express-password-protect

1.0.2 • Public • Published

express-password-protected

Simple password protection middleware for Express intended for development purposes.

Can be used in your Express Routes before the routes you need to protect.

maxAge is the duration of the cookie used to store your session, in milliseconds. Defaults to 1 day.

Example Usage

const app = require('express')()
const session = require('express-session')
const passwordProtected = require('express-password-protect')
 
const config = {
    username: "john",
    password: "1234",
    maxAge: 60000 // 1 minute
}
 
app.use(passwordProtected(config))
 
app.use(function(req, res) {
    res.send(200)
})
 
app.listen(3000, function() {
    console.log("listening on port 3000")
})

Package Sidebar

Install

npm i express-password-protect

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

6.38 kB

Total Files

6

Last publish

Collaborators

  • jdmann