Skip to main content
Module

x/nhttp/mod.ts>NHttp

An Simple http framework for Deno, Deno Deploy and Cloudflare Workers. so hot 🚀
Go to Latest
class NHttp
extends Router<Rev>
import { NHttp } from "https://deno.land/x/nhttp@1.1.11/mod.ts";

Constructors

new
NHttp(unnamed 0?: TApp)

Properties

private
optional
bodyLimit: TBodyLimit
private
env: string
private
optional
multipartParseQuery: TQueryFunc
private
parseQuery: TQueryFunc
server: Deno.Listener | undefined

Methods

private
_on404(rev: Rev, _: NextFunction): RetHandler
private
_onError(
err: TObject,
rev: Rev,
): RetHandler
private
handleConn(conn: Deno.Conn)
private
pushRoutes(
str: string,
wares: Handler[],
last: TRet,
)
private
withPromise(
handler: Promise<Handler>,
rev: Rev,
isDepError?: boolean,
)
handle(rev: Rev, isRw?: boolean)
handleEvent(event: FetchEvent)

handleEvent

listen(opts: , callback?: (err?: Error, opts?: Deno.ListenOptions | Deno.ListenTlsOptions | TObject) => void | Promise<void>)

listen the server

on(
method: string,
path: string | RegExp,
...handlers: Handlers<Rev>,
): this
on404(fn: (rev: Rev, next: NextFunction) => RetHandler)

global not found error handling.

onError(fn: (
err: TObject,
rev: Rev,
) => RetHandler
)

global error handling.

use(prefix: string | RouterOrWare<Rev> | RouterOrWare<Rev>[], ...routerOrMiddleware: Array<RouterOrWare<Rev> | RouterOrWare<Rev>[]>)

add router or middlware.