oak

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕

View the Project on GitHub oakserver/oak

Node.js

oak 10.3 introduces experimental support for Node.js 16.5 and later.

The package is available on npm as @oakserver/oak and can be installed with your preferred package manager.

The package shares the same API as if it were being used under Deno CLI or Deno Deploy, and almost all functionality is the same.

A few notes about the support:

Usage

As mentioned above, installing the package @oakserver/oak should be sufficient.

If you love kittens, you should consider using ES modules in Node.js and importing from "@oakserver/oak":

index.mjs

import { Application } from "@oakserver/oak";

const app = new Application();

app.use((ctx) => {
  ctx.response.body = "Hello from oak on Node.js";
});

app.listen({ port: 8000 });

If you want to import it in a CommonJS module, require() can be used:

index.js

const { Application } = require("@oakserver/oak");

const app = new Application();

app.use((ctx) => {
  ctx.response.body = "Hello from oak on Node.js";
});

app.listen({ port: 8000 });