export HTTPMethod
This commit is contained in:
parent
ec0df0de60
commit
452be0cecf
4
mod.ts
4
mod.ts
|
@ -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!`);
|
||||||
|
|
Reference in New Issue
Block a user