From 252aa71088b81be871aa44ae3b5d56add84968ce Mon Sep 17 00:00:00 2001 From: Mithun Kamath Date: Mon, 7 Oct 2019 15:18:03 +0530 Subject: [PATCH] #9 - Support base url --- README.md | 1 + config/default.js | 2 ++ src/app.js | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b58e30..ea006cb 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The following parameters can be set in config files or in env variables: - LOG_LEVEL: the log level - PORT: the server port +- API_VERSION: The API version - SUBMISSION_API_URL: Submission API URL - SONARQUBE_HOST: SonarQube host. Default: http://localhost:9000 diff --git a/config/default.js b/config/default.js index c44a080..e1a5e90 100644 --- a/config/default.js +++ b/config/default.js @@ -6,6 +6,8 @@ module.exports = { LOG_LEVEL: process.env.LOG_LEVEL || 'debug', PORT: process.env.PORT || 3000, + API_VERSION: process.env.API_VERSION || '/v5/qualityChecks', + SUBMISSION_API_URL: process.env.SUBMISSION_API_URL || 'https://api.topcoder-dev.com/v5', SONARQUBE_HOST: process.env.SONARQUBE_HOST || 'http://localhost:9000', diff --git a/src/app.js b/src/app.js index 7139a85..fecc68e 100644 --- a/src/app.js +++ b/src/app.js @@ -48,7 +48,7 @@ _.each(routes, (verbs, url) => { next() }) actions.push(method) - apiRouter[verb](url, helper.autoWrapExpress(actions)) + apiRouter[verb](`${config.API_VERSION}${url}`, helper.autoWrapExpress(actions)) }) })