1.3.26 • Published 23 days ago

nhttp-land v1.3.26

Weekly downloads
-
License
MIT
Repository
github
Last release
23 days ago

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).

See Examples

v1.3.0 requires Deno 1.35 or higher.

CLI

Deno

deno run -Ar npm:create-nhttp

Npm

npm create nhttp@latest

Manual Installation

deno.land

import nhttp from "https://deno.land/x/nhttp/mod.ts";

deno-npm

import nhttp from "npm:nhttp-land";

npm/yarn

npm i nhttp-land

// or

yarn add nhttp-land
// module
import nhttp from "nhttp-land";

// commonjs
const nhttp = require("nhttp-land").default;

Simple Usage

Create file app.ts and copy-paste this code.

import nhttp from "https://deno.land/x/nhttp/mod.ts";

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.

/** @jsx n */
/** @jsxFrag n.Fragment */

import nhttp from "https://deno.land/x/nhttp/mod.ts";
import { htmx, n, renderToHtml } from "https://deno.land/x/nhttp/lib/jsx.ts";

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);

Run

deno run -A app.tsx

more docs => https://nhttp.deno.dev

3rd-party libs

Like std-libs for NHttp.

Usage

// Deno
import {...} from "https://deno.land/x/nhttp/lib/my-libs.ts";

// Deno NPM
import {...} from "npm:nhttp-land/my-libs";

// Node or Bun
import {...} from "nhttp-land/my-libs";

ServeStatic

import nhttp from "https://deno.land/x/nhttp/mod.ts";
import serveStatic from "https://deno.land/x/nhttp/lib/serve-static.ts";

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)));

more libs => https://nhttp.deno.dev/docs/3rd-party-lib

License

MIT

1.3.26

23 days ago

1.3.25

2 months ago

1.3.24

4 months ago

1.3.23

4 months ago

1.3.22

4 months ago

1.3.21

4 months ago

1.3.20

4 months ago

1.3.19

4 months ago

1.3.18

4 months ago

1.3.17

5 months ago

1.3.16

5 months ago

1.3.13

6 months ago

1.3.14

5 months ago

1.3.11

7 months ago

1.3.12

7 months ago

1.3.15

5 months ago

1.3.10

8 months ago

1.3.9

8 months ago

1.3.8

9 months ago

1.2.17

12 months ago

1.2.18

12 months ago

1.2.19

11 months ago

1.3.7

9 months ago

1.3.6

10 months ago

1.3.5

10 months ago

1.3.4

10 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.20

11 months ago

1.2.23

10 months ago

1.2.24

10 months ago

1.2.21

11 months ago

1.2.22

11 months ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.11

1 year ago

1.2.16

1 year ago

1.2.14

1 year ago

1.2.15

1 year ago

1.2.0

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.12

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.19

1 year ago

0.1.20

1 year ago

1.1.18

1 year ago

0.1.21

1 year ago

1.1.17

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.24

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

1.2.9

1 year ago

1.1.22

1 year ago

1.2.10

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago