outers
Version:
outers - a all in one package for your day to day use
14 lines (13 loc) • 999 B
TypeScript
/// <reference types="qs" />
import { Request, Response, NextFunction } from "express";
/**
* Middleware function to check if the request URL is allowed or not.
*
* @param AllowedURLs - An array of allowed URLs.
* @param StatusCode - Optional. The status code to be sent if the URL is not allowed. Defaults to 406 (Not Acceptable).
* @param ErrorMessage - Optional. The error message to be sent if the URL is not allowed.
* @param Reverse - Optional. If true, the middleware will allow access to URLs not present in the AllowedURLs array. Defaults to false.
*
* @returns A middleware function that checks if the request URL is allowed and handles the response accordingly.
*/
export default function (AllowedURLs: string[], StatusCode?: number, ErrorMessage?: string, Reverse?: boolean): (Request: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, Response: Response<any, Record<string, any>>, Next: NextFunction) => void;