diff --git a/app/server.js b/app/server.js index 3c15e047..51baedb2 100644 --- a/app/server.js +++ b/app/server.js @@ -62,21 +62,21 @@ module.exports = function serverFactory (statsClient) { app.dataIngestionLogger = dataIngestionLogger; // FIXME: health controller should be atached to the main entry point: "/" - // instead of "/api/v1/" + // instead of "/api/v1/" or "/user/:user/api/:version" const healthCheckController = new HealthCheckController({ - routes: global.settings.routes + routes: global.settings.routes.api }); healthCheckController.route(app); // FIXME: version controller should be atached to the main entry point: "/" - // instead of "/api/v1/" + // instead of "/api/:version" or "/user/:user/api/:version" const versionController = new VersionController({ - routes: global.settings.routes + routes: global.settings.routes.api }); versionController.route(app); const apiRouter = new ApiRouter({ - routes: global.settings.routes, + routes: global.settings.routes.api, redisPool, metadataBackend, statsClient, diff --git a/config/environments/development.js.example b/config/environments/development.js.example index c9dbae48..1ef61235 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -2,21 +2,23 @@ // Disable by using <=0 value. module.exports.gc_interval = 10000; module.exports.routes = { - paths: [ - // In case the base_url has a :user param the username will be the one specified in the URL, - // otherwise it will fallback to extract the username from the host header. - '/api/:version', - '/user/:user/api/:version', - ], - // Attach middlewares at the begining of the req/res cycle - // to perform custom operations. - middlewares: [ - function noop () { - return function noopMiddleware (req, res, next) { - next(); + api: { + paths: [ + // In case the base_url has a :user param the username will be the one specified in the URL, + // otherwise it will fallback to extract the username from the host header. + '/api/:version', + '/user/:user/api/:version', + ], + // Attach middlewares at the begining of the req/res cycle + // to perform custom operations. + middlewares: [ + function noop () { + return function noopMiddleware (req, res, next) { + next(); + } } - } - ] + ] + } }; // If useProfiler is true every response will be served with an // X-SQLAPI-Profile header containing elapsed timing for various diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 85b6cf2a..0d3e43b6 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -2,21 +2,23 @@ // Disable by using <=0 value. module.exports.gc_interval = 10000; module.exports.routes = { - paths: [ - // In case the base_url has a :user param the username will be the one specified in the URL, - // otherwise it will fallback to extract the username from the host header. - '/api/:version', - '/user/:user/api/:version', - ], - // Attach middlewares at the begining of the req/res cycle - // to perform custom operations. - middlewares: [ - function noop () { - return function noopMiddleware (req, res, next) { - next(); + api: { + paths: [ + // In case the base_url has a :user param the username will be the one specified in the URL, + // otherwise it will fallback to extract the username from the host header. + '/api/:version', + '/user/:user/api/:version', + ], + // Attach middlewares at the begining of the req/res cycle + // to perform custom operations. + middlewares: [ + function noop () { + return function noopMiddleware (req, res, next) { + next(); + } } - } - ] + ] + } }; // If useProfiler is true every response will be served with an // X-SQLAPI-Profile header containing elapsed timing for various diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 65ca48fe..c051485d 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -2,21 +2,23 @@ // Disable by using <=0 value. module.exports.gc_interval = 10000; module.exports.routes = { - paths: [ - // In case the base_url has a :user param the username will be the one specified in the URL, - // otherwise it will fallback to extract the username from the host header. - '/api/:version', - '/user/:user/api/:version', - ], - // Attach middlewares at the begining of the req/res cycle - // to perform custom operations. - middlewares: [ - function noop () { - return function noopMiddleware (req, res, next) { - next(); + api: { + paths: [ + // In case the base_url has a :user param the username will be the one specified in the URL, + // otherwise it will fallback to extract the username from the host header. + '/api/:version', + '/user/:user/api/:version', + ], + // Attach middlewares at the begining of the req/res cycle + // to perform custom operations. + middlewares: [ + function noop () { + return function noopMiddleware (req, res, next) { + next(); + } } - } - ] + ] + } }; // If useProfiler is true every response will be served with an // X-SQLAPI-Profile header containing elapsed timing for various diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 6b55652a..ab961c41 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -2,21 +2,23 @@ // Disable by using <=0 value. module.exports.gc_interval = 10000; module.exports.routes = { - paths: [ - // In case the base_url has a :user param the username will be the one specified in the URL, - // otherwise it will fallback to extract the username from the host header. - '/api/:version', - '/user/:user/api/:version', - ], - // Attach middlewares at the begining of the req/res cycle - // to perform custom operations. - middlewares: [ - function noop () { - return function noopMiddleware (req, res, next) { - next(); + api: { + paths: [ + // In case the base_url has a :user param the username will be the one specified in the URL, + // otherwise it will fallback to extract the username from the host header. + '/api/:version', + '/user/:user/api/:version', + ], + // Attach middlewares at the begining of the req/res cycle + // to perform custom operations. + middlewares: [ + function noop () { + return function noopMiddleware (req, res, next) { + next(); + } } - } - ] + ] + } }; // If useProfiler is true every response will be served with an // X-SQLAPI-Profile header containing elapsed timing for various