Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var preAuth = require('http-auth');
- var basic = preAuth.basic({
- realm: "Private area",
- file: __dirname + "/htpasswd",
- //Type: "basic"
- });
- var server;
- var app = express();
- app.use(preAuth.connect(basic));
- app.get('/test', function(req, res) {
- res.send("Hello from express - " + req.user + "!");
- });
- app.use(preAuth.connect(basic));
- app.use(express.static(path.join(__dirname, 'public')));
Add Comment
Please, Sign In to add comment