overleaf/services/spelling/app/js/server.js
Eric Mc Sween f6c1e2738d Merge pull request #10938 from overleaf/em-esm-spelling
Migrate spelling to ES modules

GitOrigin-RevId: 4a200c8d1c28be44027cc8a3097e42575ab6593f
2022-12-21 09:03:55 +00:00

26 lines
855 B
JavaScript

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'
metrics.initialize('spelling')
logger.initialize('spelling')
if (Settings.sentry?.dsn != null) {
logger.initializeErrorReporting(Settings.sentry.dsn)
}
metrics.memory.monitor(logger)
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)