node-webserver
    Preparing search index...

    Interface RequestEvent<Params, RouteId, Locals>

    interface RequestEvent<
        Params extends
            Partial<Record<string, string>> = Partial<Record<string, string>>,
        RouteId extends string
        | null = string | null,
        Locals extends App.Locals = App.Locals,
    > {
        cookies: Cookies;
        fetch: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | Request | URL, init?: RequestInit): Promise<Response>;
        };
        getClientAddress: () => string;
        locals: Locals;
        params: Params;
        platform: Readonly<Platform> | undefined;
        request: Request;
        route: { id: RouteId };
        setHeaders: (headers: Record<string, string>) => void;
        url: URL;
    }

    Type Parameters

    • Params extends Partial<Record<string, string>> = Partial<Record<string, string>>
    • RouteId extends string | null = string | null
    • Locals extends App.Locals = App.Locals
    Index

    Properties

    cookies: Cookies

    Get or set cookies related to the current request

    fetch: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | Request | URL, init?: RequestInit): Promise<Response>;
    }

    A server-aware variant of the native fetch.

    It resolves relative URLs against event.url, forwards cookie and authorization headers by default, and dispatches same-origin requests internally through the router when possible.

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | Request | URL, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | Request | URL
        • Optionalinit: RequestInit

        Returns Promise<Response>

    getClientAddress: () => string

    The client's IP address, set by the adapter.

    locals: Locals

    Contains custom data that was added to the request within the middlewares.

    params: Params

    The parameters of the current route - e.g. for a route like /blog/[slug], a { slug: string } object.

    platform: Readonly<Platform> | undefined

    Additional data made available through the adapter.

    request: Request

    The original request object.

    route: { id: RouteId }

    Info about the current route.

    Type Declaration

    • id: RouteId

      The ID of the current route - e.g. for src/routes/blog/[slug], it would be /blog/[slug]. It is null when no route is matched.

    setHeaders: (headers: Record<string, string>) => void

    If you need to set headers for the response, you can do so using the method. This is useful if you want the page to be cached, for example:

    Setting the same header multiple times (even in separate load functions) is an error — you can only set a given header once.

    You cannot add a set-cookie header with setHeaders — use the cookies API instead.

    url: URL

    The requested URL.