1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Application, Router } from "https://deno.land/x/oak@v16.0.0/mod.ts";
import { denoServer } from "https://esm.town/v/pomdtr/deno_server?v=8";
const router = new Router();
router
.get("/", (ctx) => {
ctx.response.body = "Hello world!";
})
.get("/cat", (ctx) => {
ctx.response.body = { name: "cat" };
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
export default denoServer(app.fetch);
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.