export HTTPMethod

This commit is contained in:
HorizonCode 2023-05-12 13:57:13 +02:00
parent ec0df0de60
commit 452be0cecf

4
mod.ts
View File

@ -12,7 +12,7 @@ type ListenOptions = {
staticServePath?: string; staticServePath?: string;
}; };
enum HTTPMethod { export enum HTTPMethod {
GET = "GET", GET = "GET",
POST = "POST", POST = "POST",
PUSH = "PUSH", PUSH = "PUSH",
@ -289,7 +289,7 @@ export class HTTPServer {
this.add(HTTPMethod.DELETE, path, handler); this.add(HTTPMethod.DELETE, path, handler);
} }
private add(method: HTTPMethod, path: string, handler: RouteHandler) { add(method: HTTPMethod, path: string, handler: RouteHandler) {
const route = new Route(path, method, handler); const route = new Route(path, method, handler);
if (this.routes.has(route.routeName)) { if (this.routes.has(route.routeName)) {
console.log(`${route.routeName} already registered!`); console.log(`${route.routeName} already registered!`);