mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
prettier: convert individual decaffeinated files to Prettier format
This commit is contained in:
parent
06b93447d5
commit
2e84069653
2 changed files with 53 additions and 50 deletions
|
@ -4,57 +4,58 @@
|
||||||
* DS207: Consider shorter variations of null checks
|
* DS207: Consider shorter variations of null checks
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
const Metrics = require("metrics-sharelatex");
|
const Metrics = require('metrics-sharelatex')
|
||||||
Metrics.initialize("contacts");
|
Metrics.initialize('contacts')
|
||||||
|
|
||||||
const Settings = require("settings-sharelatex");
|
const Settings = require('settings-sharelatex')
|
||||||
const logger = require("logger-sharelatex");
|
const logger = require('logger-sharelatex')
|
||||||
const express = require("express");
|
const express = require('express')
|
||||||
const bodyParser = require("body-parser");
|
const bodyParser = require('body-parser')
|
||||||
const Errors = require("./app/js/Errors");
|
const Errors = require('./app/js/Errors')
|
||||||
const HttpController = require("./app/js/HttpController");
|
const HttpController = require('./app/js/HttpController')
|
||||||
|
|
||||||
const Path = require("path");
|
const Path = require('path')
|
||||||
|
|
||||||
|
logger.initialize('contacts')
|
||||||
logger.initialize("contacts");
|
|
||||||
if (Metrics.event_loop != null) {
|
if (Metrics.event_loop != null) {
|
||||||
Metrics.event_loop.monitor(logger);
|
Metrics.event_loop.monitor(logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = express();
|
const app = express()
|
||||||
|
|
||||||
app.use(Metrics.http.monitor(logger));
|
app.use(Metrics.http.monitor(logger))
|
||||||
|
|
||||||
Metrics.injectMetricsRoute(app);
|
Metrics.injectMetricsRoute(app)
|
||||||
|
|
||||||
app.get('/user/:user_id/contacts', HttpController.getContacts);
|
app.get('/user/:user_id/contacts', HttpController.getContacts)
|
||||||
app.post('/user/:user_id/contacts', bodyParser.json({limit: "2mb"}), HttpController.addContact);
|
app.post(
|
||||||
|
'/user/:user_id/contacts',
|
||||||
|
bodyParser.json({ limit: '2mb' }),
|
||||||
|
HttpController.addContact
|
||||||
|
)
|
||||||
|
|
||||||
app.get('/status', (req, res) => res.send('contacts is alive'));
|
app.get('/status', (req, res) => res.send('contacts is alive'))
|
||||||
|
|
||||||
app.use(function(error, req, res, next) {
|
app.use(function(error, req, res, next) {
|
||||||
logger.error({err: error}, "request errored");
|
logger.error({ err: error }, 'request errored')
|
||||||
if (error instanceof Errors.NotFoundError) {
|
if (error instanceof Errors.NotFoundError) {
|
||||||
return res.send(404);
|
return res.send(404)
|
||||||
} else {
|
} else {
|
||||||
return res.send(500, "Oops, something went wrong");
|
return res.send(500, 'Oops, something went wrong')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
const {
|
const { port } = Settings.internal.contacts
|
||||||
port
|
const { host } = Settings.internal.contacts
|
||||||
} = Settings.internal.contacts;
|
|
||||||
const {
|
|
||||||
host
|
|
||||||
} = Settings.internal.contacts;
|
|
||||||
|
|
||||||
|
if (!module.parent) {
|
||||||
if (!module.parent) { // Called directly
|
// Called directly
|
||||||
app.listen(port, host, function(error) {
|
app.listen(port, host, function(error) {
|
||||||
if (error != null) { throw error; }
|
if (error != null) {
|
||||||
return logger.info(`contacts starting up, listening on ${host}:${port}`);
|
throw error
|
||||||
});
|
}
|
||||||
|
return logger.info(`contacts starting up, listening on ${host}:${port}`)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
const http = require('http');
|
const http = require('http')
|
||||||
http.globalAgent.maxSockets = 300;
|
http.globalAgent.maxSockets = 300
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
internal: {
|
internal: {
|
||||||
contacts: {
|
contacts: {
|
||||||
port: 3036,
|
port: 3036,
|
||||||
host: process.env["LISTEN_ADDRESS"] || "localhost"
|
host: process.env.LISTEN_ADDRESS || 'localhost'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mongo: {
|
mongo: {
|
||||||
url: process.env['MONGO_CONNECTION_STRING'] || `mongodb://${process.env["MONGO_HOST"] || "localhost"}/sharelatex`
|
url:
|
||||||
}
|
process.env.MONGO_CONNECTION_STRING ||
|
||||||
};
|
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue