Skip to main content
Home

Built and signed on GitHub Actions

Middleware web-framework for creating fast and easy-to-use servers

This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Deno
It is unknown whether this package works with Bun
JSR Score
64%
Published
11 months ago (0.6.6)

Sequoia

A library for creating clean and minimalistic HTTP servers. It is inspired by Oak and it is mostly compatible with it.

Getting started

To get started you can create your own server using this snippet:

// server.ts
import { Application, Router, HTTPStatus, HTTPResponse, ContentType } from 'jsr:@sequoia/sequoia'

const app = new Application()
const router = new Router()

router.GET('/', (_ctx) => {
    return new HTTPResponse({
	      status: HTTPStatus.SUCCESS,
	      type: ContentType.JSON,
	      body: { ok: true, healthcheck: 'success' }
    })
})

app.useRouter(router)

app.listen({ port: 8000 })

Then you can run the created server by running: deno run --allow-net server.ts

It will spin up a server at http://localhost:8000. This server will respond with a JSON { ok: true, healthcheck: 'success' }

What's the difference from Oak?

The main difference that Sequoia has over Oak is the simplified approach to sending responses:

// oak.ts
(ctx) => {
    ctx.response.status = 200
    ctx.response.headers.set('Content-Type', 'application/json')
    ctx.response.body = JSON.stringify({ ok: true, healthcheck: 'success' })
}

// sequoia.ts
(_ctx) => {
    return new HTTPResponse({
        status: HTTPStatus.SUCCESS,
        type: ContentType.JSON,
        body: { ok: true, healthcheck: 'success' }
    })
}

The examples above create 2 identical Response objects, but in Sequoia we aim to give the best developer expirience possible. So instead of setting each property of response individually you can just return the HTTPResponse object from middleware. In addition to that there is an enum HTTPStatus which you can use to easily set the status code of response.

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@sequoia/sequoia

Import symbol

import * as sequoia from "@sequoia/sequoia";
or

Import directly with a jsr specifier

import * as sequoia from "jsr:@sequoia/sequoia";

Add Package

bunx jsr add @sequoia/sequoia

Import symbol

import * as sequoia from "@sequoia/sequoia";