import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const router = new Router();
const app = new Application();
router
.get("/", ({ response }) => {
response.body = "Hello world!";
})
.get("/:id", (ctx) => {
ctx.response.body = `Id: ${ctx.params.id}`;
})
.post("/echo", async ({ request, response }) => {
const body = await request.body();
response.body = body.value;
});
app.use(router.routes());
await app.listen({ port: 8000 });