diff --git a/api/config/api-url.js b/api/config/api-url.js index e474c00..cbd02ca 100644 --- a/api/config/api-url.js +++ b/api/config/api-url.js @@ -1,16 +1,18 @@ +const rootRoute = '/api'; + module.exports = { - auth: '/authenticate', - signUp: '/authenticate/signup', - awards: '/awardings', - command: '/cmd', - cmdCreateSig: '/cmd/createSignature', - decorations: '/decorations', - overview: '/overview', - ranks: '/ranks', - signatures: '/signatures', - squads: '/squads', - users: '/users', - account: '/account', - request: '/request', - wars: '/wars' + auth: rootRoute + '/authenticate', + signUp: rootRoute + '/authenticate/signup', + awards: rootRoute + '/awardings', + command: rootRoute + '/cmd', + cmdCreateSig: rootRoute + '/cmd/createSignature', + decorations: rootRoute + '/decorations', + overview: rootRoute + '/overview', + ranks: rootRoute + '/ranks', + signatures: rootRoute + '/signatures', + squads: rootRoute + '/squads', + users: rootRoute + '/users', + account: rootRoute + '/account', + request: rootRoute + '/request', + wars: rootRoute + '/wars' }; diff --git a/api/server.js b/api/server.js index 4ee2441..c51684f 100644 --- a/api/server.js +++ b/api/server.js @@ -103,21 +103,29 @@ errorResponseWare(app); // Start the server if (process.env.NODE_ENV !== config.test.env) { - mongoose.connect(config.database.uri + config.database.db); - app.listen(config.port, (err) => { - if (err !== undefined) { - debug('Error on startup, ', err); - } - else { - debug('Listening on port ' + config.port); - signatureCronJob.start(); - backupCronJob.start(); - } + const mongoosePromise = mongoose.connect(config.database.uri + config.database.db, { + useMongoClient: true }); + mongoosePromise.then((db) => { + app.listen(config.port, (err) => { + if (err !== undefined) { + debug('Error on startup, ', err); + } + else { + debug('Listening on port ' + config.port); + signatureCronJob.start(); + backupCronJob.start(); + } + }); + }) } else { - mongoose.connect(config.database.uri + config.test.db); - app.listen(config.test.port); - console.log('Listening on port ' + config.test.port); + const mongoosePromise = mongoose.connect(config.database.uri + config.test.db, { + useMongoClient: true + }); + mongoosePromise.then((db) => { + app.listen(config.test.port); + console.log('Listening on port ' + config.test.port); + }) } module.exports = app; diff --git a/static/src/app/app.component.html b/static/src/app/app.component.html index 611bdc7..46e1d09 100644 --- a/static/src/app/app.component.html +++ b/static/src/app/app.component.html @@ -16,10 +16,10 @@