Add backend Sentry reporting

This commit is contained in:
Jonathan Cremin 2017-05-26 18:33:18 +01:00
parent 2f963bc27c
commit cfaef8be94
3 changed files with 45 additions and 6 deletions

9
app.js
View file

@ -10,6 +10,7 @@ import compress from 'koa-compress';
import serve from 'koa-static';
import views from 'koa-views';
import bodyparser from 'koa-bodyparser';
import raven from 'raven';
import debuglog from 'debug';
import index from './routes/index';
import recent from './routes/recent';
@ -22,8 +23,14 @@ const debug = debuglog('match.audio');
process.env.VUE_ENV = 'server';
raven.config(process.env.SENTRY_DSN).install();
const app = koa();
app.on('error', (err) => {
raven.captureException(err);
});
app.use(errorHandler());
app.use(bodyparser());
@ -35,7 +42,7 @@ app.use(serve('public', { maxage: 31536000000 }));
const manifest = JSON.parse(fs.readFileSync(path.join(__dirname, '/public/dist/manifest.json')));
app.use(function * (next) {
app.use(function* state(next) {
this.state = { manifest };
yield next;
});