-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrikitrakiws.js
44 lines (36 loc) · 1.19 KB
/
rikitrakiws.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
34
35
36
37
38
39
40
41
42
43
44
'use strict';
var log4js = require('log4js');
var logger = log4js.getLogger();
var express = require('express');
var compression = require('compression');
var favicon = require('serve-favicon');
var bodyParser = require('body-parser');
var port = process.env.OPENSHIFT_NODEJS_PORT || 3000;
var ipaddress = process.env.OPENSHIFT_NODEJS_IP;
var loglevel = process.env.LOGLEVEL || 'DEBUG';
var app = express();
// Enforce https redirect if appropriate
/*app.enable('trust proxy');
app.use(function (req, res, next) {
// Redirect to https only if the app is deployed
if (/rikitraki/i.test(req.headers.host)) {
if (req.secure) {
next();
} else {
res.redirect('https://' + req.headers.host + req.url);
}
} else {
next();
}
});*/
// app.use(favicon(__dirname + '/public/favicon.ico'));
logger.setLevel(loglevel);
// app.use(express.static('public'));
app.use(log4js.connectLogger(log4js.getLogger('http'), { level: 'auto' }));
app.use(bodyParser.json({limit: '5mb'}));
app.use(bodyParser.raw({limit: '10mb', type: 'image/jpeg'}));
app.use(compression());
app.use('/api/', require('./routes/').router);
app.listen(port, ipaddress, function () {
logger.info('starting rikitrakiws', this.address());
});