diff --git a/index.js b/index.js index 5294bf78c7b6f7ab9e9d1ce226c247257b37e361..1b3649856a3d447fd5662c277b41b4dc56b89e49 100644 --- a/index.js +++ b/index.js @@ -72,8 +72,8 @@ app.use(route.get('/freshclam', require('./routes/freshclam.js'))); * Return a 200 OK response, so that Elastic Beanstalk can check if the server * is still online. */ -app.use(route.get('/health', (req, res, next) => { - res.status(200).end(); +app.use(route.get('/health', () => { + this.status = 200; })); // Listen on 8080 diff --git a/routes/freshclam.js b/routes/freshclam.js index a0b952a5e3fc1e13f84aba9b1bdf8ef2539d9f48..02089238ec6743a6159c7348f5ce88830bb785e2 100644 --- a/routes/freshclam.js +++ b/routes/freshclam.js @@ -5,16 +5,12 @@ const freshClam = require('../lib/freshclam.js'); * > GET /freshclam * Run freshclam to update the virus database. */ -module.exports = function* freshclam(next) { +module.exports = function* freshclam() { freshClam().then(() => { - this.body = null; this.status = 200; - yield; }).catch(err => { console.error('failed to update virus definitions'); console.error(err); - this.body = null; this.status = 500; - yield; }); }