diff --git a/app/index.js b/app/index.js index 425802da0..553c46277 100644 --- a/app/index.js +++ b/app/index.js @@ -29,12 +29,12 @@ $injector.registerImports([ 'graphql', 'deepmerge', 'stoppable' -], module); +]); // Register modules that need require and not import $injector.registerRequires([ 'graphql' -], module); +]); // Register the imported modules with custom names. $injector.registerImports({ @@ -45,7 +45,7 @@ $injector.registerImports({ GraphQLLong: 'graphql-type-long', GraphQLUUID: 'graphql-type-uuid', gql: 'graphql-tag' -}, module); +}); // Register all of the single js files as modules. $injector.registerPath([ diff --git a/app/server.js b/app/server.js index 3d82888e0..f00244cf4 100644 --- a/app/server.js +++ b/app/server.js @@ -10,7 +10,7 @@ * all copies or substantial portions of the Software. */ - /** +/** * The Graphql server. */ module.exports = function ($injector, fs, net, express, config, log, getEndpoints, stoppable) { @@ -26,17 +26,17 @@ module.exports = function ($injector, fs, net, express, config, log, getEndpoint graphApp.applyMiddleware({ app }); // List all endpoints at start of server - app.get('/', (req, res, next) => { + app.get('/', (_, res) => { return res.send(getEndpoints(app)); }); // Handle errors by logging them and returning a 500. - app.use(function (err, req, res, next) { - log.error(err); - if (err.stack) { - err.stackTrace = err.stack; + app.use(function (error, _, res, _) { + log.error(error); + if (error.stack) { + error.stackTrace = error.stack; } - res.status(error.status || 500).send(err); + res.status(error.status || 500).send(error); }); // Return an object with start and stop methods. @@ -44,9 +44,9 @@ module.exports = function ($injector, fs, net, express, config, log, getEndpoint start() { server = stoppable(app.listen(port, () => { // Downgrade process user to owner of this file - return fs.stat(__filename, (err, stats) => { - if (err) { - throw err; + return fs.stat(__filename, (error, stats) => { + if (error) { + throw error; } return process.setuid(stats.uid); @@ -92,9 +92,9 @@ module.exports = function ($injector, fs, net, express, config, log, getEndpoint }, stop() { // Stop the server from accepting new connections and close existing connections - return server.close(err => { - if (err) { - log.error(err); + return server.close(error => { + if (error) { + log.error(error); // Exit with error (code 1) // eslint-disable-next-line process.exit(1); diff --git a/index.js b/index.js index 098eb7359..08449de3b 100644 --- a/index.js +++ b/index.js @@ -10,8 +10,5 @@ * all copies or substantial portions of the Software. */ -// Set process title -process.title = require('./package.json').name.split('/')[1]; - // Boot app require('./app');