diff --git a/logger-server.js b/logger-server.js index 516153a..22dd3b5 100644 --- a/logger-server.js +++ b/logger-server.js @@ -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 -}))); +})));*/ diff --git a/server/loggerhandler.js b/server/loggerhandler.js index 99cb102..6b12597 100644 --- a/server/loggerhandler.js +++ b/server/loggerhandler.js @@ -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) {