logger/logger-server.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-03-08 21:10:12 +00:00
var express = require('express'), path = require('path'), http = require('http'),
favicon = require('serve-favicon'),
logger = require('morgan'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
loggerHandler = require('./server/loggerhandler')
;
2016-05-12 14:16:52 +00:00
2016-05-12 14:30:22 +00:00
2016-05-12 14:16:52 +00:00
2016-03-08 21:10:12 +00:00
var app = express();
2016-05-12 14:30:22 +00:00
/*app.use(authentication(({
2016-05-12 14:16:52 +00:00
hash: 'sha256', // type of hash
file: 'htpasswd.txt', // path of file
suppress: true // suppress throwing Error if wrong user
2016-05-12 14:30:22 +00:00
})));*/
2016-05-12 14:16:52 +00:00
2016-03-08 21:10:12 +00:00
app.set('port', process.env.PORT || 8027);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.text());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'app')));
app.use('/', loggerHandler);
/**
* create the server
*/
app.listen(app.get('port'), function () {
console.log('Keeper Server listening on ' + app.get('port'));
});/**
* Created by Martin on 22/02/2016.
*/