Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement