overleaf/services/chat/app/js/server.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

/* eslint-disable
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const metrics = require('@overleaf/metrics')
metrics.initialize('chat')
2019-01-04 06:37:48 -05:00
const logger = require('logger-sharelatex')
2019-02-05 13:50:57 -05:00
logger.initialize('chat')
const Path = require('path')
const express = require('express')
2020-03-06 13:33:17 -05:00
const bodyParser = require('body-parser')
const errorHandler = require('errorhandler')
const app = express()
const server = require('http').createServer(app)
const Router = require('./router')
2014-08-15 05:50:36 -04:00
2020-03-06 13:33:17 -05:00
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
app.use(metrics.http.monitor(logger))
2019-01-04 06:37:48 -05:00
metrics.injectMetricsRoute(app)
2014-08-15 05:50:36 -04:00
if (app.get('env') === 'development') {
2020-03-06 13:33:17 -05:00
app.use(errorHandler({ dumpExceptions: true, showStack: true }))
}
2014-08-15 05:50:36 -04:00
if (app.get('env') === 'production') {
2020-03-06 13:33:17 -05:00
app.use(errorHandler())
}
2014-08-15 05:50:36 -04:00
Router.route(app)
2014-08-15 05:50:36 -04:00
module.exports = {
server,
2021-07-13 07:04:48 -04:00
app,
}