...

/

Exploring Deno HTTP Frameworks: Oak and Alosaur

Exploring Deno HTTP Frameworks: Oak and Alosaur

Explore the Oak and Alosaur Deno HTTP frameworks.

We'll cover the following...

Oak

Oak is currently the most popular Deno library when it comes to creating web applications. Its name derives from a play on the words of Koa, a very popular Node.js middleware framework and Oak’s main inspiration.

Due to its heavy inspirations, it’s no surprise that its APIs resemble Koa by using asynchronous functions and a context object. Oak also includes a router, also inspired by @koa/router.

If you know Koa, the following code might look very familiar to you:

Press + to interact
import { Application } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
app.use((ctx) => {
ctx.response.body = "Hello world!";
});
await app.listen("127.0.0.1:8000");

For those of you who are not familiar with Koa, we’ll explain it in brief since understanding it will help you understand Oak.

Koa provides a minimal and unopinionated approach by using modern JavaScript features. One of the initial reasons Koa was created (by the same team who created Express.js) was that its creator wanted to create a framework that would leverage modern JavaScript features, as opposed to Express, which was ...