mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -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
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const Metrics = require("metrics-sharelatex");
|
||||
Metrics.initialize("contacts");
|
||||
const Metrics = require('metrics-sharelatex')
|
||||
Metrics.initialize('contacts')
|
||||
|
||||
const Settings = require("settings-sharelatex");
|
||||
const logger = require("logger-sharelatex");
|
||||
const express = require("express");
|
||||
const bodyParser = require("body-parser");
|
||||
const Errors = require("./app/js/Errors");
|
||||
const HttpController = require("./app/js/HttpController");
|
||||
const Settings = require('settings-sharelatex')
|
||||
const logger = require('logger-sharelatex')
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
const Errors = require('./app/js/Errors')
|
||||
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) {
|
||||
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.post('/user/:user_id/contacts', bodyParser.json({limit: "2mb"}), HttpController.addContact);
|
||||
app.get('/user/:user_id/contacts', HttpController.getContacts)
|
||||
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) {
|
||||
logger.error({err: error}, "request errored");
|
||||
if (error instanceof Errors.NotFoundError) {
|
||||
return res.send(404);
|
||||
} else {
|
||||
return res.send(500, "Oops, something went wrong");
|
||||
}
|
||||
});
|
||||
logger.error({ err: error }, 'request errored')
|
||||
if (error instanceof Errors.NotFoundError) {
|
||||
return res.send(404)
|
||||
} else {
|
||||
return res.send(500, 'Oops, something went wrong')
|
||||
}
|
||||
})
|
||||
|
||||
const {
|
||||
port
|
||||
} = Settings.internal.contacts;
|
||||
const {
|
||||
host
|
||||
} = Settings.internal.contacts;
|
||||
const { port } = Settings.internal.contacts
|
||||
const { host } = Settings.internal.contacts
|
||||
|
||||
|
||||
if (!module.parent) { // Called directly
|
||||
app.listen(port, host, function(error) {
|
||||
if (error != null) { throw error; }
|
||||
return logger.info(`contacts starting up, listening on ${host}:${port}`);
|
||||
});
|
||||
if (!module.parent) {
|
||||
// Called directly
|
||||
app.listen(port, host, function(error) {
|
||||
if (error != null) {
|
||||
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');
|
||||
http.globalAgent.maxSockets = 300;
|
||||
const http = require('http')
|
||||
http.globalAgent.maxSockets = 300
|
||||
|
||||
module.exports = {
|
||||
internal: {
|
||||
contacts: {
|
||||
port: 3036,
|
||||
host: process.env["LISTEN_ADDRESS"] || "localhost"
|
||||
}
|
||||
},
|
||||
internal: {
|
||||
contacts: {
|
||||
port: 3036,
|
||||
host: process.env.LISTEN_ADDRESS || 'localhost'
|
||||
}
|
||||
},
|
||||
|
||||
mongo: {
|
||||
url: process.env['MONGO_CONNECTION_STRING'] || `mongodb://${process.env["MONGO_HOST"] || "localhost"}/sharelatex`
|
||||
}
|
||||
};
|
||||
mongo: {
|
||||
url:
|
||||
process.env.MONGO_CONNECTION_STRING ||
|
||||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue