authentication

This commit is contained in:
Martin Donnelly 2016-05-12 15:30:22 +01:00
parent bd7bedae9f
commit 98b822f168
2 changed files with 12 additions and 4 deletions

View File

@ -9,16 +9,16 @@ var express = require('express'), path = require('path'), http = require('http')
;
var authentication =require('basic-authentication');
var app = express();
app.use(authentication(({
/*app.use(authentication(({
hash: 'sha256', // type of hash
file: 'htpasswd.txt', // path of file
suppress: true // suppress throwing Error if wrong user
})));
})));*/

View File

@ -13,6 +13,14 @@ var router = express.Router();
var EventEmitter = require('events');
var authentication =require('basic-authentication')();
var authOptions = {
hash: 'sha256', // type of hash
file: 'htpasswd.txt', // path of file
suppress: true // suppress throwing Error if wrong user
};
var nano = require('nano')('http://martind2000:1V3D4m526i@localhost:5984');
var busEmitter = new EventEmitter();
@ -44,7 +52,7 @@ var doInsertLog = (obj) =>{
busEmitter.on('saveLog', doInsertLog);
router.get('/', function (req, res) {
router.get('/', authentication(authOptions), function (req, res) {
logger.debug('list..');
dbCouch.view('body','body',function(err, body) {