UNPKG

nextjs-api-router

Version:

Lightweight tool to build clean restful API routes for your Next.js application.

5 lines (4 loc) 445 B
import { NextApiRequest, NextApiResponse } from "next"; export declare type Method = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; export declare type Handler<T = any> = (req: NextApiRequest, res: NextApiResponse<T>, next: (value?: unknown) => void) => unknown; export declare type Controller<T = any> = Record<Method, Handler<T> | Handler<T>[] | undefined> | Record<string, Handler<T> | Handler<T>[]>;