JSPM

@stricjs/router

4.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 45
  • Score
    100M100P100Q80600F

A router for StricJS

Package Exports

  • @stricjs/router
  • @stricjs/router/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stricjs/router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A router for StricJS.

import { Router } from "@stricjs/router";

// Create a router and serve using Bun
export default new Router()
  // Handle GET request to `/`
  .get("/", () => new Response("Hi"))
  // Handle POST request to `/json`
  .post("/json", async req => Response.json(await req.json()))
  // Return 90 for requests to `/id/90` for instance
  .get("/id/:id", req => new Response(req.params.id))
  // Use the default 404 handler
  .use(404);

Benchmark

You can see the latest benchmark result here.

I recommend benchmarking this on your machine.