import { Application, Context, Next, Router } from "jsr:@oak/oak"; interface HelloWorldState { hello?: string; world?: string; } async function hello(ctx: Context, next: Next) { ctx.state.hello = "Hello"; await next(); } async function world(ctx: Context, next: Next) { ctx.state.world = "world"; await next(); } const router = new Router(); router.get("/hello", hello, world, (ctx) => { ctx.response.body = `${ctx.state.hello}, ${ctx.state.world}!`; }); const app = new Application(); app.use(router.routes()); app.use(router.allowedMethods()); app.listen({ port: 8000 });