outers
Version:
outers - a all in one package for your day to day use
14 lines (13 loc) • 1.05 kB
TypeScript
/// <reference types="qs" />
import { Request, Response, NextFunction } from "express";
/**
* Middleware function to restrict access based on IP address or URL.
*
* @param AllowedIP - An array of allowed IP addresses. must be in string format
* @param StatusCode - Optional. The status code to be sent in the response if access is denied. Defaults to 406 (Not Acceptable).
* @param ErrorMessage - Optional. The error message to be sent in the response if access is denied. Defaults to "You are not allowed to access this server from this IP/URL."
* @param Reverse - Optional. If true, the middleware will allow access only if the requester IP/URL is not in the allowed list. Defaults to false.
*
* @returns The middleware function.
*/
export default function (AllowedIP: string[], StatusCode?: number, ErrorMessage?: string, Reverse?: false): (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;