port domainMiddleware

This commit is contained in:
Matteo Pagliazzi
2015-11-15 18:12:55 +01:00
parent 1cd7189119
commit 5dc2fb0b6f
2 changed files with 18 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import passport from 'passport';
import passportFacebook from 'passport-facebook';
import mongoose from 'mongoose';
import Q from 'q';
import domainMiddleware from './middlewares/api-v3/domain';
import attachMiddlewares from './middlewares/api-v3/index';
utils.setupConfig();
@@ -84,6 +85,7 @@ app.set('port', nconf.get('PORT'));
let oldApp = express(); // api v1 and v2, and not scoped routes
let newApp = express(); // api v3
app.use(domainMiddleware(server, mongoose));
// Route requests to the right app
// Matches all request except the ones going to /api/v3/**
app.all(/^(?!\/api\/v3).+/i, oldApp);