1 | var expo = module.exports = function(app, dir) {
|
2 | // Use source maps
|
3 | require('source-map-support').install();
|
4 |
|
5 | require('./lib/app')(app);
|
6 | app.root = dir;
|
7 | return app;
|
8 | };
|
9 |
|
10 | /**
|
11 | * Middleware proxy to express.errorHandler, but let 404 errors through.
|
12 | *
|
13 | * app.use(app.errorHandler(express.errorHandler));
|
14 | */
|
15 |
|
16 | expo.errorHandler = function(handler) {
|
17 | return function(err, req, res, next) {
|
18 | if (err === 404) return next(404);
|
19 | handler(err, req, res, next);
|
20 | };
|
21 | };
|
22 |
|