@orveth/cors
v0.1.0
Published
CORS middleware for Orveth HTTP applications.
Maintainers
Readme
@orveth/cors
CORS middleware for @orveth/server apps: origins, methods, preflight, credentials, and Access-Control-Max-Age.
Install
npm install @orveth/cors @orveth/serverUsage
import { Orveth } from "@orveth/server";
import { cors } from "@orveth/cors";
const app = new Orveth();
app.use(
cors({
origin: "https://example.com",
methods: ["GET", "POST"],
credentials: true,
}),
);
app.get("/", async (ctx) => {
await ctx.text("ok");
});
await app.listen(3000);Register CORS with app.use so OPTIONS preflight runs before route matching.
License
MIT — VLODIA
