authentication
This commit is contained in:
parent
bd7bedae9f
commit
98b822f168
@ -9,16 +9,16 @@ var express = require('express'), path = require('path'), http = require('http')
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
var authentication =require('basic-authentication');
|
|
||||||
|
|
||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
app.use(authentication(({
|
/*app.use(authentication(({
|
||||||
hash: 'sha256', // type of hash
|
hash: 'sha256', // type of hash
|
||||||
file: 'htpasswd.txt', // path of file
|
file: 'htpasswd.txt', // path of file
|
||||||
suppress: true // suppress throwing Error if wrong user
|
suppress: true // suppress throwing Error if wrong user
|
||||||
})));
|
})));*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,14 @@ var router = express.Router();
|
|||||||
|
|
||||||
var EventEmitter = require('events');
|
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 nano = require('nano')('http://martind2000:1V3D4m526i@localhost:5984');
|
||||||
var busEmitter = new EventEmitter();
|
var busEmitter = new EventEmitter();
|
||||||
|
|
||||||
@ -44,7 +52,7 @@ var doInsertLog = (obj) =>{
|
|||||||
busEmitter.on('saveLog', doInsertLog);
|
busEmitter.on('saveLog', doInsertLog);
|
||||||
|
|
||||||
|
|
||||||
router.get('/', function (req, res) {
|
router.get('/', authentication(authOptions), function (req, res) {
|
||||||
logger.debug('list..');
|
logger.debug('list..');
|
||||||
|
|
||||||
dbCouch.view('body','body',function(err, body) {
|
dbCouch.view('body','body',function(err, body) {
|
||||||
|
Loading…
Reference in New Issue
Block a user