2022-12-20 07:11:25 -05:00
|
|
|
import metrics from '@overleaf/metrics'
|
|
|
|
import Settings from '@overleaf/settings'
|
|
|
|
import logger from '@overleaf/logger'
|
|
|
|
import express from 'express'
|
|
|
|
import bodyParser from 'body-parser'
|
|
|
|
import * as SpellingAPIController from './SpellingAPIController.js'
|
|
|
|
import * as HealthCheckController from './HealthCheckController.js'
|
|
|
|
|
|
|
|
logger.initialize('spelling')
|
|
|
|
if (Settings.sentry?.dsn != null) {
|
|
|
|
logger.initializeErrorReporting(Settings.sentry.dsn)
|
|
|
|
}
|
|
|
|
metrics.memory.monitor(logger)
|
2023-05-30 09:25:50 -04:00
|
|
|
metrics.leaked_sockets.monitor(logger)
|
2023-05-22 06:36:51 -04:00
|
|
|
metrics.open_sockets.monitor()
|
2022-12-20 07:11:25 -05:00
|
|
|
|
|
|
|
export const app = express()
|
|
|
|
|
|
|
|
metrics.injectMetricsRoute(app)
|
|
|
|
|
|
|
|
app.use(bodyParser.json({ limit: '2mb' }))
|
|
|
|
app.use(metrics.http.monitor(logger))
|
|
|
|
|
|
|
|
app.post('/user/:user_id/check', SpellingAPIController.check)
|
|
|
|
app.get('/status', (req, res) => res.send({ status: 'spelling api is up' }))
|
|
|
|
|
|
|
|
app.get('/health_check', HealthCheckController.healthCheck)
|