IvanDev / sunder

Sunder is a minimal server-side framework for building APIs and websites on Cloudflare Workers.

Home Page:https://sunderjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌄 Sunder

CI License NPM badge Documentation

Sunder allows you to quickly build websites and APIs in a modern async structure on Cloudflare Workers. Think of Sunder as Express or Koa for serverless.

Sunder is

  • Fast
  • Small
  • Easy to test
  • Typesafe

The easiest way to get started with Sunder on Cloudflare Workers is to use the template project.

Installation

npm i --save sunder
# or
yarn add sunder

Read the documentation here to get started.

Example

import {Sunder, Router, Context} from "sunder";

const app = new Sunder();
const router = new Router();

// Example route with a named parameter
router.get("/hello/:username", ({response, params}) => {
    response.body = `Hello ${params.username}`;
});
app.use(router.middleware);

export default {
    fetch(request, ctx, env) {
        return app.fetch(request, ctx, env);
    }
};

Highlight feature: strict route parameters

Strict routes gif

Inspiration

The Sunder framework was inspired by Elixir's plug, Node's Koa framework, tiny-request-router and cfworker's web package.

Sunder is only a few hundred lines of code. It has little magic and doesn't impose too much structure.

License

MIT

About

Sunder is a minimal server-side framework for building APIs and websites on Cloudflare Workers.

https://sunderjs.com

License:MIT License


Languages

Language:TypeScript 87.2%Language:JavaScript 10.2%Language:CSS 2.6%