2018-12-20 14:13:56 -05:00
|
|
|
/* eslint-disable
|
|
|
|
no-unused-vars,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
2018-12-20 14:13:53 -05:00
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2018-12-20 14:13:59 -05:00
|
|
|
const metrics = require('metrics-sharelatex')
|
|
|
|
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')
|
2018-12-20 14:13:59 -05:00
|
|
|
const Path = require('path')
|
|
|
|
const express = require('express')
|
|
|
|
const app = express()
|
|
|
|
const server = require('http').createServer(app)
|
|
|
|
const Router = require('./router')
|
2014-08-15 05:50:36 -04:00
|
|
|
|
2018-12-20 14:13:59 -05:00
|
|
|
app.use(express.bodyParser())
|
|
|
|
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
|
|
|
|
2018-12-20 14:13:59 -05:00
|
|
|
if (app.get('env') === 'development') {
|
|
|
|
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }))
|
2018-12-20 14:13:53 -05:00
|
|
|
}
|
2014-08-15 05:50:36 -04:00
|
|
|
|
2018-12-20 14:13:59 -05:00
|
|
|
if (app.get('env') === 'production') {
|
|
|
|
app.use(express.logger())
|
|
|
|
app.use(express.errorHandler())
|
2018-12-20 14:13:53 -05:00
|
|
|
}
|
2014-08-15 05:50:36 -04:00
|
|
|
|
2018-12-20 14:13:59 -05:00
|
|
|
Router.route(app)
|
2014-08-15 05:50:36 -04:00
|
|
|
|
2018-12-20 14:13:59 -05:00
|
|
|
module.exports = {
|
|
|
|
server,
|
|
|
|
app
|
|
|
|
}
|