2017-08-24 23:54:02 +02:00
|
|
|
const express = require('express');
|
|
|
|
const path = require('path');
|
|
|
|
const Raven = require('raven');
|
|
|
|
const config = require('./config');
|
|
|
|
const routes = require('./routes');
|
|
|
|
const pages = require('./routes/pages');
|
|
|
|
|
|
|
|
if (config.sentry_dsn) {
|
|
|
|
Raven.config(config.sentry_dsn).install();
|
|
|
|
}
|
|
|
|
|
|
|
|
const app = express();
|
|
|
|
|
2017-11-06 22:36:36 +01:00
|
|
|
routes(app);
|
|
|
|
|
2017-08-24 23:54:02 +02:00
|
|
|
app.use(
|
|
|
|
express.static(path.resolve(__dirname, '../dist/'), {
|
|
|
|
setHeaders: function(res) {
|
|
|
|
res.set('Cache-Control', 'public, max-age=31536000, immutable');
|
2017-11-06 22:36:36 +01:00
|
|
|
res.removeHeader('Pragma');
|
2017-08-24 23:54:02 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
app.use(pages.notfound);
|
|
|
|
|
2017-12-09 02:22:36 +01:00
|
|
|
app.listen(config.listen_port,config.listen_address);
|