Advertisement
Guest User

Untitled

a guest
May 25th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // heartbeat.js
  2. module.exports = function* heartbeat(next) {
  3. if (this.path !== '/heartbeat') {
  4. return yield next;
  5. }
  6.  
  7. this.body = 'OK';
  8. }
  9.  
  10. // in the index.js, we use the middleware
  11. const app = koa();
  12. // ...
  13. app.use(heartbeat);
  14. // ... more middleware, etc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement