express-allow-methods
Version:
Express middleware for sending HTTP 405 Method Not Allowed response
10 lines (9 loc) • 384 B
TypeScript
import type { IRoute } from "express";
import type HttpMethod from "./http-method.type";
/** @public Only those methods from `require("http").METHODS` that are supported by Express */
declare type ExpressHttpMethod = Lowercase<HttpMethod> & ({
[Key in keyof IRoute]: IRoute[Key] extends {
(): void;
} ? Key : never;
})[keyof IRoute];
export default ExpressHttpMethod;