-
Notifications
You must be signed in to change notification settings - Fork 111
/
server.js
33 lines (25 loc) · 813 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @file Main file of the app
* @author Vladan Kudlac <[email protected]>
*/
import {server as config} from './config';
import express from 'express';
const server = express();
const bodyParser = require('body-parser');
server.use(bodyParser.urlencoded({ extended: true }));
server.use(bodyParser.json());
const log4js = require('log4js');
import log from './models/logger';
server.use(log4js.connectLogger(log, { level: 'auto', statusRules: [
{ codes: [304], level: 'info' }
]}));
// View
server.engine('html', require('ejs').renderFile);
server.set('view engine', 'html');
// Router
const router = require('./router.js');
server.use('/', router);
server.use(express.static('public'));
server.listen(config.port, config.host, () => {
log.info('Express listening on port', config.port);
});