Skip to content

StricJS è un framework Bun per costruire applicazioni web e API ad alte prestazioni.

  • Veloce — Stric è uno dei framework Bun più veloci. Consulta benchmark per ulteriori dettagli.
  • Minimale — I componenti di base come @stricjs/router e @stricjs/utils sono sotto i 50kB e non richiedono dipendenze esterne.
  • Estensibile — Stric include un sistema di plugin, dependency injection e ottimizzazioni opzionali per la gestione delle richieste.

Usa bun init per creare un progetto vuoto.

bash
mkdir myapp
cd myapp
bun init
bun add @stricjs/router @stricjs/utils

Per implementare un semplice server HTTP con StricJS:

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

export default new Router().get("/", () => new Response("Ciao"));

Per servire file statici da /public:

ts
import { dir } from "@stricjs/utils";

export default new Router().get("/", () => new Response("Ciao")).get("/*", dir("./public"));

Esegui il file in modalità watch per avviare il server di sviluppo.

bash
bun --watch run index.ts

Per ulteriori informazioni, consulta la documentazione di Stric.

Bun a cura di www.bunjs.com.cn