@ffsm/napi
Version:
Napi - A framework using with Next.js for building APIs.
76 lines (75 loc) • 2.29 kB
TypeScript
import { NextRequest } from "next/server";
import { NapiMethod } from "./enums";
import { Cookie } from "@ffsm/cookie";
export declare class NapiRouter {
private readonly req;
private readonly _route;
private readonly _params;
private _headers;
private _cookie;
private _method;
private _url;
private _mode;
private _host;
private _schema;
private _hostname;
private _port;
private _userAgent;
private _href;
private _pathname;
private _username;
private _password;
private _origin;
private _protocol;
private _search;
private _query;
constructor(req: NextRequest, _route: string, _params: Record<string, string>);
private extract;
getHeader(name: string): string;
getCookie(name: string): {
name: string;
value: string;
expires?: string | number | Date;
path?: string;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: "strict" | "lax" | "none";
encode?: boolean | ((value: string) => string);
priority?: "low" | "medium" | "high";
maxAge?: number;
partitioned?: boolean;
baseDomain?: boolean;
} | undefined;
json(): Promise<any>;
text(): Promise<string>;
formData(): Promise<FormData>;
arrayBuffer(): Promise<ArrayBuffer>;
get method(): NapiMethod;
get headers(): Record<string, string>;
get cookies(): import("@ffsm/cookie").CookieSerialized[];
get url(): string;
get mode(): string;
get host(): string;
get schema(): string | undefined;
get hostname(): string | undefined;
get port(): number | undefined;
get userAgent(): string | undefined;
get href(): string | undefined;
get pathname(): string | undefined;
get path(): string | undefined;
get username(): string | undefined;
get password(): string | undefined;
get origin(): string | undefined;
get protocol(): string | undefined;
get search(): string;
get query(): Record<string, unknown>;
get params(): Record<string, string>;
get route(): string;
get auth(): {
username: string | undefined;
password: string | undefined;
};
get body(): Promise<any>;
get cookie(): Cookie;
}