Last active
August 29, 2015 14:19
-
-
Save NickHeiner/100d9e7b9f887b7f566b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// heartbeat.js | |
module.exports = function* heartbeat(next) { | |
if (this.path !== '/heartbeat') { | |
return yield next; | |
} | |
this.body = 'OK'; | |
} | |
// in the index.js, we use the middleware | |
const app = koa(); | |
// ... | |
app.use(heartbeat); | |
// ... more middleware, etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment