Skip to main content

A focused RESTful server framework 🌰

Works with
This package works with Bun
This package works with Deno
JSR Score
100%
Published
3 months ago (0.5.1)

Provides a router which specifically tailored for providing RESTful endpoints.

Using with Deno

You need to reference the @oak/acorn package in code:

Examples

Example 1

import { Router } from "jsr:@oak/acorn/router";

const router = new Router();

router.get("/", () => ({ hello: "world" }));

const BOOKS = {
  "1": { title: "The Hound of the Baskervilles" },
  "2": { title: "It" },
};

router.get("/books/:id", (ctx) => BOOKS[ctx.params.id]);

router.listen({ port: 3000 });

Using with Bun

You need to install/add the package to your project via:

bunx jsr add @oak/acorn

And then you import it into your project:

Example 2

import { Router } from "@oak/acorn/router";

const router = new Router();

router.get("/", () => ({ hello: "world" }));

const BOOKS = {
  "1": { title: "The Hound of the Baskervilles" },
  "2": { title: "It" },
};

router.get("/books/:id", (ctx) => BOOKS[ctx.params.id]);

router.listen({ port: 3000 });

Add Package

deno add @oak/acorn

Import symbol

import * as mod from "@oak/acorn";

Add Package

bunx jsr add @oak/acorn

Import symbol

import * as mod from "@oak/acorn";