-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathServer.js
More file actions
29 lines (23 loc) · 784 Bytes
/
Server.js
File metadata and controls
29 lines (23 loc) · 784 Bytes
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
var express = require('express');
var path = require('path');
var http = require('http');
try {
var config = require('./config/config');
} catch (error) {
console.log("Config file is not setup. Read README.md for config setup.");
return;
}
var log = require('./logging');
if (config.server.api.slice(-1) === '/') {
config.server.api = config.server.api.slice(0,-1);
}
log.info('Starting Full Noise.');
var app = express();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use(express.static(path.join(__dirname, 'public')));
log.addExpressApp(app);
require('./router')(app);
log.info("API: " + config.server.api);
log.info("Starting service listening to port " + config.server.port);
http.createServer(app).listen(config.server.port);