Merge pull request #64 from overleaf/jpa-rename-express-app-var

[misc] align the variable name of the express app with other services
This commit is contained in:
Jakob Ackermann 2020-07-22 11:09:58 +02:00 committed by GitHub
commit 8e8a05e94f

View file

@ -18,22 +18,22 @@ metrics.memory.monitor(logger)
const SpellingAPIController = require('./app/js/SpellingAPIController') const SpellingAPIController = require('./app/js/SpellingAPIController')
const express = require('express') const express = require('express')
const server = express() const app = express()
metrics.injectMetricsRoute(server) metrics.injectMetricsRoute(app)
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const HealthCheckController = require('./app/js/HealthCheckController') const HealthCheckController = require('./app/js/HealthCheckController')
server.use(bodyParser.json({ limit: '2mb' })) app.use(bodyParser.json({ limit: '2mb' }))
server.use(metrics.http.monitor(logger)) app.use(metrics.http.monitor(logger))
server.del('/user/:user_id', SpellingAPIController.deleteDic) app.del('/user/:user_id', SpellingAPIController.deleteDic)
server.get('/user/:user_id', SpellingAPIController.getDic) app.get('/user/:user_id', SpellingAPIController.getDic)
server.post('/user/:user_id/check', SpellingAPIController.check) app.post('/user/:user_id/check', SpellingAPIController.check)
server.post('/user/:user_id/learn', SpellingAPIController.learn) app.post('/user/:user_id/learn', SpellingAPIController.learn)
server.post('/user/:user_id/unlearn', SpellingAPIController.unlearn) app.post('/user/:user_id/unlearn', SpellingAPIController.unlearn)
server.get('/status', (req, res) => res.send({ status: 'spelling api is up' })) app.get('/status', (req, res) => res.send({ status: 'spelling api is up' }))
server.get('/health_check', HealthCheckController.healthCheck) app.get('/health_check', HealthCheckController.healthCheck)
const settings = const settings =
Settings.internal && Settings.internal.spelling Settings.internal && Settings.internal.spelling
@ -44,7 +44,7 @@ const port = settings && settings.port ? settings.port : 3005
if (!module.parent) { if (!module.parent) {
// application entry point, called directly // application entry point, called directly
server.listen(port, host, function(error) { app.listen(port, host, function(error) {
if (error != null) { if (error != null) {
throw error throw error
} }
@ -52,4 +52,4 @@ if (!module.parent) {
}) })
} }
module.exports = server module.exports = app