Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var express = require('express');
- var app = express();
- var auth = require('http-auth');
- app.use(express.static('www'));
- var basic = auth.basic({
- realm: 'SUPER SECRET STUFF'
- }, function(username, password, callback) {
- callback(username == 'username' && password == 'password');
- });
- app.use("/", auth.connect(basic));
- app.set('port', (process.env.PORT || 4000));
- app.listen(app.get('port'), function() {
- console.log('Node app is running on port', app.get('port'));
- });
- 'use strict';
- var express = require('express');
- var app = express();
- var auth = require('http-auth');
- var basic = auth.basic({
- realm: 'SUPER SECRET STUFF'
- }, function(username, password, callback) {
- callback(username == 'username' && password == 'password');
- });
- app.use(auth.connect(basic));
- app.use(express.static('www'));
- app.set('port', (process.env.PORT || 4000));
- app.listen(app.get('port'), function() {
- console.log('Node app is running on port', app.get('port'));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement