h3

  • Version 1.0.1
  • Published
  • 74.3 kB
  • 4 dependencies
  • MIT license

Install

npm i h3
yarn add h3
pnpm add h3

Overview

Tiny JavaScript Server

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable appendHeader

const appendHeader: (event: H3Event, name: string, value: string) => void;

    variable appendHeaders

    const appendHeaders: (event: H3Event, headers: Record<string, string>) => void;

      variable eventHandler

      const eventHandler: <T = any>(handler: EventHandler<T>) => EventHandler<T>;

        variable getHeader

        const getHeader: (event: H3Event, name: string) => string;

          variable getHeaders

          const getHeaders: (event: H3Event) => RequestHeaders;

            variable lazyEventHandler

            const lazyEventHandler: (factory: LazyEventHandler) => EventHandler<any>;

              variable MIMES

              const MIMES: { html: string; json: string };

                variable setHeader

                const setHeader: (event: H3Event, name: string, value: unknown) => void;

                  variable setHeaders

                  const setHeaders: (event: H3Event, headers: Record<string, unknown>) => void;

                    Functions

                    function appendResponseHeader

                    appendResponseHeader: (event: H3Event, name: string, value: string) => void;

                      function appendResponseHeaders

                      appendResponseHeaders: (event: H3Event, headers: Record<string, string>) => void;

                        function assertMethod

                        assertMethod: (
                        event: H3Event,
                        expected: HTTPMethod | HTTPMethod[],
                        allowHead?: boolean
                        ) => void;

                          function callNodeListener

                          callNodeListener: (
                          handler: NodeMiddleware,
                          req: IncomingMessage,
                          res: ServerResponse
                          ) => Promise<unknown>;

                            function createApp

                            createApp: (options?: AppOptions) => App;

                              function createAppEventHandler

                              createAppEventHandler: (stack: Stack, options: AppOptions) => EventHandler<void>;

                                function createError

                                createError: (
                                input: string | (Partial<H3Error> & { status?: number; statusText?: string })
                                ) => H3Error;
                                • Creates new Error that can be used to handle both internal and runtime errors.

                                  Parameter input

                                  {H3Error} An instance of the H3Error

                                function createEvent

                                createEvent: (req: IncomingMessage, res: ServerResponse) => H3Event;

                                  function createRouter

                                  createRouter: (opts?: CreateRouterOptions) => Router;

                                    function defaultContentType

                                    defaultContentType: (event: H3Event, type?: string) => void;

                                      function defineEventHandler

                                      defineEventHandler: <T = any>(handler: EventHandler<T>) => EventHandler<T>;

                                        function defineLazyEventHandler

                                        defineLazyEventHandler: (factory: LazyEventHandler) => EventHandler;

                                          function defineNodeListener

                                          defineNodeListener: (handler: NodeListener) => NodeListener;

                                            function defineNodeMiddleware

                                            defineNodeMiddleware: (middleware: NodeMiddleware) => NodeMiddleware;

                                              function deleteCookie

                                              deleteCookie: (
                                              event: H3Event,
                                              name: string,
                                              serializeOptions?: CookieSerializeOptions
                                              ) => void;
                                              • Set a cookie value by name.

                                                Parameter event

                                                H3 event or res passed by h3 handler

                                                Parameter name

                                                Name of the cookie to delete

                                                Parameter serializeOptions

                                                Cookie options

                                                deleteCookie(res, 'SessionId')

                                              function dynamicEventHandler

                                              dynamicEventHandler: (initial?: EventHandler) => DynamicEventHandler;

                                                function fromNodeMiddleware

                                                fromNodeMiddleware: (handler: NodeListener | NodeMiddleware) => EventHandler;

                                                  function getCookie

                                                  getCookie: (event: H3Event, name: string) => string | undefined;
                                                  • Get a cookie value by name.

                                                    Parameter event

                                                    H3 event or req passed by h3 handler

                                                    Parameter name

                                                    Name of the cookie to get

                                                    Returns

                                                    {*} Value of the cookie (String or undefined)

                                                    const authorization = useCookie(request, 'Authorization')

                                                  function getMethod

                                                  getMethod: (event: H3Event, defaultMethod?: HTTPMethod) => HTTPMethod;

                                                    function getQuery

                                                    getQuery: (event: H3Event) => ufo.QueryObject;

                                                      function getRequestHeader

                                                      getRequestHeader: (event: H3Event, name: string) => RequestHeaders[string];

                                                        function getRequestHeaders

                                                        getRequestHeaders: (event: H3Event) => RequestHeaders;

                                                          function getResponseHeader

                                                          getResponseHeader: (
                                                          event: H3Event,
                                                          name: string
                                                          ) => ReturnType<H3Event['res']['getHeader']>;

                                                            function getResponseHeaders

                                                            getResponseHeaders: (event: H3Event) => ReturnType<H3Event['res']['getHeaders']>;

                                                              function getRouterParam

                                                              getRouterParam: (event: H3Event, name: string) => H3Event['context'][string];

                                                                function getRouterParams

                                                                getRouterParams: (event: H3Event) => H3Event['context'];

                                                                  function handleCacheHeaders

                                                                  handleCacheHeaders: (event: H3Event, opts: CacheConditions) => boolean;
                                                                  • Check request caching headers (If-Modified-Since) and add caching headers (Last-Modified, Cache-Control) Note: public cache control will be added by default

                                                                    Returns

                                                                    true when cache headers are matching. When true is returned, no reponse should be sent anymore

                                                                  function isError

                                                                  isError: (input: any) => input is H3Error;

                                                                    function isEvent

                                                                    isEvent: (input: any) => input is H3Event;

                                                                      function isEventHandler

                                                                      isEventHandler: (input: any) => input is EventHandler<any>;

                                                                        function isMethod

                                                                        isMethod: (
                                                                        event: H3Event,
                                                                        expected: HTTPMethod | HTTPMethod[],
                                                                        allowHead?: boolean
                                                                        ) => boolean;

                                                                          function isStream

                                                                          isStream: (data: any) => any;

                                                                            function parseCookies

                                                                            parseCookies: (event: H3Event) => Record<string, string>;
                                                                            • Parse the request to get HTTP Cookie header string and returning an object of all cookie name-value pairs.

                                                                              Parameter event

                                                                              H3 event or req passed by h3 handler

                                                                              Returns

                                                                              Object of cookie name-value pairs

                                                                              const cookies = parseCookies(event)

                                                                            function promisifyNodeListener

                                                                            promisifyNodeListener: (
                                                                            handler: NodeListener | NodeMiddleware
                                                                            ) => NodePromisifiedHandler;

                                                                              function proxyRequest

                                                                              proxyRequest: (
                                                                              event: H3Event,
                                                                              target: string,
                                                                              opts?: ProxyOptions
                                                                              ) => Promise<void>;

                                                                                function readBody

                                                                                readBody: <T = any>(event: H3Event) => Promise<T>;
                                                                                • Reads request body and try to safely parse using [destr](https://github.com/unjs/destr)

                                                                                  Parameter event

                                                                                  H3 event or req passed by h3 handler

                                                                                  Parameter encoding

                                                                                  encoding="utf-8" - The character encoding to use.

                                                                                  {*} The Object, Array, String, Number, Boolean, or null value corresponding to the request JSON body

                                                                                  const body = await useBody(req)

                                                                                function readRawBody

                                                                                readRawBody: (
                                                                                event: H3Event,
                                                                                encoding?: Encoding
                                                                                ) => Encoding extends false ? Buffer : Promise<string | Buffer | undefined>;
                                                                                • Reads body of the request and returns encoded raw string (default) or Buffer if encoding if falsy.

                                                                                  Parameter event

                                                                                  H3 event or req passed by h3 handler

                                                                                  Parameter encoding

                                                                                  encoding="utf-8" - The character encoding to use.

                                                                                  {String|Buffer} Encoded raw string or raw Buffer of the body

                                                                                function send

                                                                                send: (event: H3Event, data?: any, type?: string) => Promise<void>;

                                                                                  function sendError

                                                                                  sendError: (event: H3Event, error: Error | H3Error, debug?: boolean) => void;
                                                                                  • Receive an error and return the corresponding response. H3 internally uses this function to handle unhandled errors. Note that calling this function will close the connection and no other data will be sent to client afterwards.

                                                                                    Parameter event

                                                                                    H3 event or req passed by h3 handler

                                                                                    Parameter error

                                                                                    Raised error

                                                                                    Parameter debug

                                                                                    Whether application is in debug mode. In the debug mode the stack trace of errors will be return in response.

                                                                                  function sendProxy

                                                                                  sendProxy: (
                                                                                  event: H3Event,
                                                                                  target: string,
                                                                                  opts?: ProxyOptions
                                                                                  ) => Promise<void>;

                                                                                    function sendRedirect

                                                                                    sendRedirect: (event: H3Event, location: string, code?: number) => Promise<void>;

                                                                                      function sendStream

                                                                                      sendStream: (event: H3Event, data: any) => Promise<void>;

                                                                                        function setCookie

                                                                                        setCookie: (
                                                                                        event: H3Event,
                                                                                        name: string,
                                                                                        value: string,
                                                                                        serializeOptions?: CookieSerializeOptions
                                                                                        ) => void;
                                                                                        • Set a cookie value by name.

                                                                                          Parameter event

                                                                                          H3 event or res passed by h3 handler

                                                                                          Parameter name

                                                                                          Name of the cookie to set

                                                                                          Parameter value

                                                                                          Value of the cookie to set

                                                                                          Parameter serializeOptions

                                                                                          Options for serializing the cookie

                                                                                          setCookie(res, 'Authorization', '1234567')

                                                                                        function setResponseHeader

                                                                                        setResponseHeader: (
                                                                                        event: H3Event,
                                                                                        name: string,
                                                                                        value: Parameters<OutgoingMessage['setHeader']>[1]
                                                                                        ) => void;

                                                                                          function setResponseHeaders

                                                                                          setResponseHeaders: (
                                                                                          event: H3Event,
                                                                                          headers: Record<string, Parameters<OutgoingMessage['setHeader']>[1]>
                                                                                          ) => void;

                                                                                            function toEventHandler

                                                                                            toEventHandler: (input: any, _?: any, _route?: string) => EventHandler;

                                                                                              function toNodeListener

                                                                                              toNodeListener: (app: App) => NodeListener;

                                                                                                function use

                                                                                                use: (
                                                                                                app: App,
                                                                                                arg1: string | EventHandler | InputLayer | InputLayer[],
                                                                                                arg2?: Partial<InputLayer> | EventHandler | EventHandler[],
                                                                                                arg3?: Partial<InputLayer>
                                                                                                ) => App;

                                                                                                  function useBase

                                                                                                  useBase: (base: string, handler: EventHandler) => EventHandler;

                                                                                                    function writeEarlyHints

                                                                                                    writeEarlyHints: (
                                                                                                    event: H3Event,
                                                                                                    hints: string | string[] | Record<string, string | string[]>,
                                                                                                    cb?: () => void
                                                                                                    ) => void;

                                                                                                      Classes

                                                                                                      class H3Error

                                                                                                      class H3Error extends Error {}
                                                                                                      • H3 Runtime Error Error {Number} statusCode An Integer indicating the HTTP response status code. {String} statusMessage A String representing the HTTP status message {String} fatal Indicates if the error is a fatal error. {String} unhandled Indicates if the error was unhandled and auto captured. {Any} data An extra data that will includes in the response. This can be used to pass additional information about the error. {Boolean} internal Setting this property to true will mark error as an internal error

                                                                                                      property data

                                                                                                      data?: any;

                                                                                                        property fatal

                                                                                                        fatal: boolean;

                                                                                                          property statusCode

                                                                                                          statusCode: number;

                                                                                                            property statusMessage

                                                                                                            statusMessage?: string;

                                                                                                              property unhandled

                                                                                                              unhandled: boolean;

                                                                                                                method toJSON

                                                                                                                toJSON: () => Pick<H3Error, 'statusCode' | 'statusMessage' | 'data' | 'message'>;

                                                                                                                  class H3Event

                                                                                                                  class H3Event implements Pick<FetchEvent, 'respondWith'> {}

                                                                                                                    constructor

                                                                                                                    constructor(req: IncomingMessage, res: ServerResponse);

                                                                                                                      property "__is_event__"

                                                                                                                      '__is_event__': boolean;

                                                                                                                        property context

                                                                                                                        context: H3EventContext;

                                                                                                                          property node

                                                                                                                          node: NodeEventContext;

                                                                                                                            property path

                                                                                                                            readonly path: string;

                                                                                                                              property req

                                                                                                                              readonly req: IncomingMessage;
                                                                                                                              • Deprecated

                                                                                                                                Please use event.node.res instead. *

                                                                                                                              property res

                                                                                                                              readonly res: ServerResponse<IncomingMessage>;
                                                                                                                              • Deprecated

                                                                                                                                Please use event.node.res instead. *

                                                                                                                              method respondWith

                                                                                                                              respondWith: (r: H3Response | PromiseLike<H3Response>) => void;

                                                                                                                                class H3Headers

                                                                                                                                class H3Headers implements Headers {}

                                                                                                                                  constructor

                                                                                                                                  constructor(init?: HeadersInit);

                                                                                                                                    method [Symbol.iterator]

                                                                                                                                    [Symbol.iterator]: () => IterableIterator<[string, string]>;

                                                                                                                                      method append

                                                                                                                                      append: (name: string, value: string) => void;

                                                                                                                                        method delete

                                                                                                                                        delete: (name: string) => void;

                                                                                                                                          method entries

                                                                                                                                          entries: () => IterableIterator<[string, string]>;

                                                                                                                                            method forEach

                                                                                                                                            forEach: (
                                                                                                                                            callbackfn: (value: string, key: string, parent: Headers) => void
                                                                                                                                            ) => void;

                                                                                                                                              method get

                                                                                                                                              get: (name: string) => string | null;

                                                                                                                                                method has

                                                                                                                                                has: (name: string) => boolean;

                                                                                                                                                  method keys

                                                                                                                                                  keys: () => IterableIterator<string>;

                                                                                                                                                    method set

                                                                                                                                                    set: (name: string, value: string) => void;

                                                                                                                                                      method values

                                                                                                                                                      values: () => IterableIterator<string>;

                                                                                                                                                        class H3Response

                                                                                                                                                        class H3Response implements Response {}

                                                                                                                                                          constructor

                                                                                                                                                          constructor(body?: any, init?: ResponseInit);

                                                                                                                                                            property body

                                                                                                                                                            readonly body: ReadableStream<Uint8Array>;

                                                                                                                                                              property bodyUsed

                                                                                                                                                              readonly bodyUsed: boolean;

                                                                                                                                                                property headers

                                                                                                                                                                readonly headers: H3Headers;

                                                                                                                                                                  property ok

                                                                                                                                                                  readonly ok: boolean;

                                                                                                                                                                    property redirected

                                                                                                                                                                    readonly redirected: boolean;

                                                                                                                                                                      property status

                                                                                                                                                                      readonly status: number;

                                                                                                                                                                        property statusText

                                                                                                                                                                        readonly statusText: string;

                                                                                                                                                                          property type

                                                                                                                                                                          readonly type: ResponseType;

                                                                                                                                                                            property url

                                                                                                                                                                            readonly url: string;

                                                                                                                                                                              method arrayBuffer

                                                                                                                                                                              arrayBuffer: () => Promise<ArrayBuffer>;

                                                                                                                                                                                method blob

                                                                                                                                                                                blob: () => Promise<Blob>;

                                                                                                                                                                                  method clone

                                                                                                                                                                                  clone: () => H3Response;

                                                                                                                                                                                    method formData

                                                                                                                                                                                    formData: () => Promise<FormData>;

                                                                                                                                                                                      method json

                                                                                                                                                                                      json: <T = any>() => Promise<T>;

                                                                                                                                                                                        method text

                                                                                                                                                                                        text: () => Promise<string>;

                                                                                                                                                                                          Interfaces

                                                                                                                                                                                          interface App

                                                                                                                                                                                          interface App {}

                                                                                                                                                                                            property handler

                                                                                                                                                                                            handler: EventHandler;

                                                                                                                                                                                              property options

                                                                                                                                                                                              options: AppOptions;

                                                                                                                                                                                                property stack

                                                                                                                                                                                                stack: Stack;

                                                                                                                                                                                                  property use

                                                                                                                                                                                                  use: AppUse;

                                                                                                                                                                                                    interface AppOptions

                                                                                                                                                                                                    interface AppOptions {}

                                                                                                                                                                                                      property debug

                                                                                                                                                                                                      debug?: boolean;

                                                                                                                                                                                                        property onError

                                                                                                                                                                                                        onError?: (error: Error, event: H3Event) => any;

                                                                                                                                                                                                          interface AppUse

                                                                                                                                                                                                          interface AppUse {}

                                                                                                                                                                                                            call signature

                                                                                                                                                                                                            (
                                                                                                                                                                                                            route: string | string[],
                                                                                                                                                                                                            handler: EventHandler | EventHandler[],
                                                                                                                                                                                                            options?: Partial<InputLayer>
                                                                                                                                                                                                            ): App;

                                                                                                                                                                                                              call signature

                                                                                                                                                                                                              (handler: EventHandler | EventHandler[], options?: Partial<InputLayer>): App;

                                                                                                                                                                                                                call signature

                                                                                                                                                                                                                (options: InputLayer): App;

                                                                                                                                                                                                                  interface CacheConditions

                                                                                                                                                                                                                  interface CacheConditions {}

                                                                                                                                                                                                                    property cacheControls

                                                                                                                                                                                                                    cacheControls?: string[];

                                                                                                                                                                                                                      property etag

                                                                                                                                                                                                                      etag?: string;

                                                                                                                                                                                                                        property maxAge

                                                                                                                                                                                                                        maxAge?: number;

                                                                                                                                                                                                                          property modifiedTime

                                                                                                                                                                                                                          modifiedTime?: string | Date;

                                                                                                                                                                                                                            interface CreateRouterOptions

                                                                                                                                                                                                                            interface CreateRouterOptions {}

                                                                                                                                                                                                                              property preemtive

                                                                                                                                                                                                                              preemtive?: boolean;

                                                                                                                                                                                                                                interface DynamicEventHandler

                                                                                                                                                                                                                                interface DynamicEventHandler extends EventHandler {}

                                                                                                                                                                                                                                  property set

                                                                                                                                                                                                                                  set: (handler: EventHandler) => void;

                                                                                                                                                                                                                                    interface EventHandler

                                                                                                                                                                                                                                    interface EventHandler<T = any> {}

                                                                                                                                                                                                                                      property "__is_handler__"

                                                                                                                                                                                                                                      __is_handler__?: true;

                                                                                                                                                                                                                                        call signature

                                                                                                                                                                                                                                        (event: H3Event): EventHandlerResponse<T>;

                                                                                                                                                                                                                                          interface H3EventContext

                                                                                                                                                                                                                                          interface H3EventContext extends Record<string, any> {}

                                                                                                                                                                                                                                            interface InputLayer

                                                                                                                                                                                                                                            interface InputLayer {}

                                                                                                                                                                                                                                              property handler

                                                                                                                                                                                                                                              handler: EventHandler;

                                                                                                                                                                                                                                                property lazy

                                                                                                                                                                                                                                                lazy?: boolean;

                                                                                                                                                                                                                                                  property match

                                                                                                                                                                                                                                                  match?: Matcher;

                                                                                                                                                                                                                                                    property route

                                                                                                                                                                                                                                                    route?: string;

                                                                                                                                                                                                                                                      interface Layer

                                                                                                                                                                                                                                                      interface Layer {}

                                                                                                                                                                                                                                                        property handler

                                                                                                                                                                                                                                                        handler: EventHandler;

                                                                                                                                                                                                                                                          property match

                                                                                                                                                                                                                                                          match?: Matcher;

                                                                                                                                                                                                                                                            property route

                                                                                                                                                                                                                                                            route: string;

                                                                                                                                                                                                                                                              interface NodeEventContext

                                                                                                                                                                                                                                                              interface NodeEventContext {}

                                                                                                                                                                                                                                                                property req

                                                                                                                                                                                                                                                                req: IncomingMessage;

                                                                                                                                                                                                                                                                  property res

                                                                                                                                                                                                                                                                  res: ServerResponse;

                                                                                                                                                                                                                                                                    interface ProxyOptions

                                                                                                                                                                                                                                                                    interface ProxyOptions {}

                                                                                                                                                                                                                                                                      property fetch

                                                                                                                                                                                                                                                                      fetch?: typeof fetch;

                                                                                                                                                                                                                                                                        property fetchOptions

                                                                                                                                                                                                                                                                        fetchOptions?: RequestInit;

                                                                                                                                                                                                                                                                          property headers

                                                                                                                                                                                                                                                                          headers?: RequestHeaders | HeadersInit;

                                                                                                                                                                                                                                                                            property sendStream

                                                                                                                                                                                                                                                                            sendStream?: boolean;

                                                                                                                                                                                                                                                                              interface Router

                                                                                                                                                                                                                                                                              interface Router extends AddRouteShortcuts {}

                                                                                                                                                                                                                                                                                property add

                                                                                                                                                                                                                                                                                add: RouterUse;

                                                                                                                                                                                                                                                                                  property handler

                                                                                                                                                                                                                                                                                  handler: EventHandler;

                                                                                                                                                                                                                                                                                    property use

                                                                                                                                                                                                                                                                                    use: RouterUse;

                                                                                                                                                                                                                                                                                      Type Aliases

                                                                                                                                                                                                                                                                                      type AddRouteShortcuts

                                                                                                                                                                                                                                                                                      type AddRouteShortcuts = Record<RouterMethod, RouterUse>;

                                                                                                                                                                                                                                                                                        type Encoding

                                                                                                                                                                                                                                                                                        type Encoding =
                                                                                                                                                                                                                                                                                        | false
                                                                                                                                                                                                                                                                                        | 'ascii'
                                                                                                                                                                                                                                                                                        | 'utf8'
                                                                                                                                                                                                                                                                                        | 'utf-8'
                                                                                                                                                                                                                                                                                        | 'utf16le'
                                                                                                                                                                                                                                                                                        | 'ucs2'
                                                                                                                                                                                                                                                                                        | 'ucs-2'
                                                                                                                                                                                                                                                                                        | 'base64'
                                                                                                                                                                                                                                                                                        | 'latin1'
                                                                                                                                                                                                                                                                                        | 'binary'
                                                                                                                                                                                                                                                                                        | 'hex';

                                                                                                                                                                                                                                                                                          type EventHandlerResponse

                                                                                                                                                                                                                                                                                          type EventHandlerResponse<T = any> = T | Promise<T>;

                                                                                                                                                                                                                                                                                            type HTTPMethod

                                                                                                                                                                                                                                                                                            type HTTPMethod =
                                                                                                                                                                                                                                                                                            | 'GET'
                                                                                                                                                                                                                                                                                            | 'HEAD'
                                                                                                                                                                                                                                                                                            | 'PATCH'
                                                                                                                                                                                                                                                                                            | 'POST'
                                                                                                                                                                                                                                                                                            | 'PUT'
                                                                                                                                                                                                                                                                                            | 'DELETE'
                                                                                                                                                                                                                                                                                            | 'CONNECT'
                                                                                                                                                                                                                                                                                            | 'OPTIONS'
                                                                                                                                                                                                                                                                                            | 'TRACE';

                                                                                                                                                                                                                                                                                              type InputStack

                                                                                                                                                                                                                                                                                              type InputStack = InputLayer[];

                                                                                                                                                                                                                                                                                                type LazyEventHandler

                                                                                                                                                                                                                                                                                                type LazyEventHandler = () => EventHandler | Promise<EventHandler>;

                                                                                                                                                                                                                                                                                                  type Matcher

                                                                                                                                                                                                                                                                                                  type Matcher = (url: string, event?: H3Event) => boolean;

                                                                                                                                                                                                                                                                                                    type NodeListener

                                                                                                                                                                                                                                                                                                    type NodeListener = (req: IncomingMessage, res: ServerResponse) => void;

                                                                                                                                                                                                                                                                                                      type NodeMiddleware

                                                                                                                                                                                                                                                                                                      type NodeMiddleware = (
                                                                                                                                                                                                                                                                                                      req: IncomingMessage,
                                                                                                                                                                                                                                                                                                      res: ServerResponse,
                                                                                                                                                                                                                                                                                                      next: (err?: Error) => any
                                                                                                                                                                                                                                                                                                      ) => any;

                                                                                                                                                                                                                                                                                                        type NodePromisifiedHandler

                                                                                                                                                                                                                                                                                                        type NodePromisifiedHandler = (
                                                                                                                                                                                                                                                                                                        req: IncomingMessage,
                                                                                                                                                                                                                                                                                                        res: ServerResponse
                                                                                                                                                                                                                                                                                                        ) => Promise<any>;

                                                                                                                                                                                                                                                                                                          type RequestHeaders

                                                                                                                                                                                                                                                                                                          type RequestHeaders = {
                                                                                                                                                                                                                                                                                                          [name: string]: string | undefined;
                                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                                            type RouterMethod

                                                                                                                                                                                                                                                                                                            type RouterMethod = Lowercase<HTTPMethod>;

                                                                                                                                                                                                                                                                                                              type RouterUse

                                                                                                                                                                                                                                                                                                              type RouterUse = (
                                                                                                                                                                                                                                                                                                              path: string,
                                                                                                                                                                                                                                                                                                              handler: EventHandler,
                                                                                                                                                                                                                                                                                                              method?: RouterMethod | RouterMethod[]
                                                                                                                                                                                                                                                                                                              ) => Router;

                                                                                                                                                                                                                                                                                                                type Stack

                                                                                                                                                                                                                                                                                                                type Stack = Layer[];

                                                                                                                                                                                                                                                                                                                  Package Files (1)

                                                                                                                                                                                                                                                                                                                  Dependencies (4)

                                                                                                                                                                                                                                                                                                                  Dev Dependencies (19)

                                                                                                                                                                                                                                                                                                                  Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                  No peer dependencies.

                                                                                                                                                                                                                                                                                                                  Badge

                                                                                                                                                                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/h3.

                                                                                                                                                                                                                                                                                                                  • Markdown
                                                                                                                                                                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/h3)
                                                                                                                                                                                                                                                                                                                  • HTML
                                                                                                                                                                                                                                                                                                                    <a href="https://www.jsdocs.io/package/h3"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>