Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit e85a0c2

Browse files
Set the api prefix
1 parent 31ff7e3 commit e85a0c2

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following parameters can be set in config files or in env variables:
1212

1313
- LOG_LEVEL: the log level
1414
- PORT: the server port
15+
- API_VERSION: the API version
1516
- CHALLENGE_API_URL: the Topcoder challenge API URL
1617
- MEMBER_API_URL: the Topcoder member API URL
1718
- AUTH0_URL: Auth0 URL, used to get TC M2M token

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
module.exports = {
66
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
77
PORT: process.env.PORT || 3000,
8+
API_VERSION: process.env.API_VERSION || '/v5',
89
AUTH_SECRET: process.env.AUTH_SECRET || 'mysecret',
910
VALID_ISSUERS: process.env.VALID_ISSUERS ? process.env.VALID_ISSUERS.replace(/\\"/g, '')
1011
: '["https://topcoder-dev.auth0.com/", "https://api.topcoder.com"]',

src/app.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ app.use(cors())
5858
app.use(bodyParser.json())
5959
app.use(bodyParser.urlencoded({ extended: true }))
6060

61-
const apiRouter = express.Router()
62-
6361
// load all routes
6462
_.each(routes, (verbs, url) => {
6563
_.each(verbs, (def, verb) => {
@@ -102,12 +100,10 @@ _.each(routes, (verbs, url) => {
102100
}
103101

104102
actions.push(method)
105-
apiRouter[verb](url, helper.autoWrapExpress(actions))
103+
app[verb](`${config.API_VERSION}${url}`, helper.autoWrapExpress(actions))
106104
})
107105
})
108106

109-
app.use('/v5/', apiRouter)
110-
111107
app.use((err, req, res, next) => {
112108
logger.logFullError(err, req.signature)
113109
const errorResponse = {}

0 commit comments

Comments
 (0)