created server/bin/ for server entrypoints

- added server/bin/test.js for the frontend test runner
This commit is contained in:
Danny Coates 2018-06-22 13:32:24 -07:00
parent dafe4884fc
commit c157e4d31c
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
7 changed files with 35 additions and 17 deletions

29
server/bin/prod.js Normal file
View file

@ -0,0 +1,29 @@
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');
const expressWs = require('express-ws');
if (config.sentry_dsn) {
Raven.config(config.sentry_dsn).install();
}
const app = express();
expressWs(app, null, { perMessageDeflate: false });
app.ws('/api/ws', require('../routes/ws'));
routes(app);
app.use(
express.static(path.resolve(__dirname, '../../dist/'), {
setHeaders: function(res) {
res.set('Cache-Control', 'public, max-age=31536000, immutable');
res.removeHeader('Pragma');
}
})
);
app.use(pages.notfound);
app.listen(config.listen_port, config.listen_address);