import { Jups } from './jups'; import { Request } from './request'; import { Response } from './response'; import { RouteRegex } from './routes'; export declare type NextCallback = (error?: string | Error) => void; export interface Middleware extends RouteRegex { callback: MiddlewareCallback; } export declare type MiddlewareCallback = (req: Request, res: Response, next: NextCallback) => void; /** * This function fetches all of the matching middleware from a `Jups` instance. * This will also work with subapps. * * @param jups The `Jups` instance to check if any of the middleware match. * @param req The `Request` object. * @param url The URL that the middleware will be matched against. */ export declare function fetchMiddleware(jups: Jups, req: Request, url: string): void; /** * This function handles firing all the middleware on the `Request` object. * Middleware works with async functions as well as non-async functions. * * @param req The `Request` object. * @param res The `Response` object. */ export declare function handleMiddleware(req: Request, res: Response): Promise;