logger/logger-server.js
2016-05-12 15:30:22 +01:00

46 lines
1.0 KiB
JavaScript

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')
;
var app = express();
/*app.use(authentication(({
hash: 'sha256', // type of hash
file: 'htpasswd.txt', // path of file
suppress: true // suppress throwing Error if wrong user
})));*/
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.
*/