mirror of
https://github.com/koajs/examples.git
synced 2026-01-18 14:38:19 +00:00
19 lines
308 B
JavaScript
19 lines
308 B
JavaScript
const Koa = require('koa');
|
|
|
|
// koa app
|
|
|
|
const app = new Koa();
|
|
|
|
app.use(async function(ctx, next) {
|
|
await next();
|
|
ctx.set('X-Custom', 'Dub Dub Dub App');
|
|
});
|
|
|
|
app.use(async function(ctx, next) {
|
|
await next();
|
|
if ('/' != ctx.url) return;
|
|
ctx.body = 'Hello from www app';
|
|
});
|
|
|
|
module.exports = app;
|