0fe0e09d62
- added core/shared to watched folders in grunt - moved sentry to shared - moved express initialisation to a shared file - always set trust proxy + sentry error handler - use this new express init everywhere, and remove duplicate trust proxy and sentry error handler code
17 lines
510 B
JavaScript
17 lines
510 B
JavaScript
const express = require('express');
|
|
const sentry = require('./sentry');
|
|
|
|
module.exports = () => {
|
|
const app = express();
|
|
|
|
// Make sure 'req.secure' is valid for proxied requests
|
|
// (X-Forwarded-Proto header will be checked, if present)
|
|
// NB: required here because it's not passed down via vhost
|
|
app.enable('trust proxy');
|
|
|
|
// Sentry must be our first error handler. Mounting it here means all custom error handlers will come after
|
|
app.use(sentry.errorHandler);
|
|
|
|
return app;
|
|
};
|