Skip to main content

Cloudflare Workers

create new project using npm

npm create cloudflare@latest my-app

cd my-app

npx jsr add @nhttp/nhttp

Code

import nhttp from "@nhttp/nhttp";

const app = nhttp();

app.get("/", () => {
return "Hello, World";
});

app.get("/cat", () => {
return { name: "cat" };
});

export default app.module();

Run Dev

npm run dev

More info https://developers.cloudflare.com/workers/