Просмотр исходного кода

[misc] align the variable name of the express app with other services

Jakob Ackermann 6 лет назад
Родитель
Сommit
236292c2f8
1 измененных файлов с 13 добавлено и 13 удалено
  1. 13 13
      services/spelling/app.js

+ 13 - 13
services/spelling/app.js

@@ -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()
-metrics.injectMetricsRoute(server)
+const app = express()
+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' }))
-server.use(metrics.http.monitor(logger))
+app.use(bodyParser.json({ limit: '2mb' }))
+app.use(metrics.http.monitor(logger))
 
 
-server.del('/user/:user_id', SpellingAPIController.deleteDic)
-server.get('/user/:user_id', SpellingAPIController.getDic)
-server.post('/user/:user_id/check', SpellingAPIController.check)
-server.post('/user/:user_id/learn', SpellingAPIController.learn)
-server.post('/user/:user_id/unlearn', SpellingAPIController.unlearn)
-server.get('/status', (req, res) => res.send({ status: 'spelling api is up' }))
+app.del('/user/:user_id', SpellingAPIController.deleteDic)
+app.get('/user/:user_id', SpellingAPIController.getDic)
+app.post('/user/:user_id/check', SpellingAPIController.check)
+app.post('/user/:user_id/learn', SpellingAPIController.learn)
+app.post('/user/:user_id/unlearn', SpellingAPIController.unlearn)
+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