Attributes
Includes Deno configuration
Repository
Current version released
6 months ago
Versions
- 2.0.2Latest
- 2.0.1
- 2.0.0
- 1.3.26
- 1.3.25
- 1.3.24
- 1.3.23
- 1.3.22
- 1.3.21
- 1.3.20
- 1.3.19
- 1.3.18
- 1.3.17
- 1.3.16
- 1.3.15
- 1.3.14
- 1.3.13
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.20
- 1.2.19
- 1.2.18
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.20
- 1.1.19
- 1.1.18
- 1.1.17
- 1.1.16
- 1.1.15
- 1.1.14
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- 0.0.6
- 0.0.5
- 0.0.3
- 0.0.2
- 0.0.1
NHttp
An Simple web-framework for Deno and Friends.
Features
- Focus on simple and easy to use.
- Fast Performance. One of the fastest Frameworks.
- Cross runtime support (Deno, Node, Bun, etc).
- Low overhead & True handlers (no caching anything).
- Built-in Middleware.
- Sub router support.
- Template engine support (jsx, ejs, nunjucks, eta, pug, ..etc).
- Return directly on handlers.
- Auto parses the body (
json / urlencoded / multipart / raw
).
Installation
JSR
// Deno
deno add @nhttp/nhttp
// npm
npx jsr add @nhttp/nhttp
// Yarn
yarn dlx jsr add @nhttp/nhttp
// pnpm
pnpm dlx jsr add @nhttp/nhttp
// Bun
bunx jsr add @nhttp/nhttp
deno.land
import nhttp from "https://deno.land/x/nhttp/mod.ts";
Simple Usage
Create file app.ts
and copy-paste this code.
import nhttp from "@nhttp/nhttp";
const app = nhttp();
app.get("/", () => {
return "Hello, World";
});
app.get("/cat", () => {
return { name: "cat" };
});
app.listen(8000);
Run
deno run -A app.ts
Using JSX + Htmx
Create file app.tsx
and copy-paste this code.
import nhttp from "@nhttp/nhttp";
import { htmx, renderToHtml } from "@nhttp/nhttp/jsx";
const app = nhttp();
app.engine(renderToHtml);
app.use(htmx());
app.get("/", () => {
return (
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me
</button>
);
});
app.post("/clicked", () => {
return <span>It's Me</span>;
});
app.listen(8000);
config jsx
deno.json / tsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@nhttp/nhttp/jsx"
}
}
more docs => https://nhttp.deno.dev
Standard Lib
Like std-libs
for NHttp.
Usage
// JSR
import {...} from "@nhttp/nhttp/my-libs";
// deno.land
import {...} from "https://deno.land/x/nhttp/lib/my-libs.ts";
Serve Static
import nhttp from "@nhttp/nhttp";
import serveStatic from "@nhttp/nhttp/serve-static";
const app = nhttp();
app.use(serveStatic("./my_folder"));
// with prefix
app.use(serveStatic("./my_folder", { prefix: "/assets" }));
// or
// app.use("/assets", serveStatic("./my_folder"));
// with URL
app.use(serveStatic(new URL("./my_folder", import.meta.url)));
CLI
Deno
deno run -Ar npm:create-nhttp
Npm
npm create nhttp@latest