rexuws
Version:
An express-like framework built on top of uWebsocket.js aims at simple codebase and high performance
50 lines (49 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../../utils/types");
/**
* @abstract
* Compatible layer to map user defined http endpoint to uWebSockets.js
*/
class AbstractRoutingParser {
constructor() {
/**
* A single store consists of method,path, middlewares
*/
this.routeHandlers = new Map();
}
get(...args) {
return this.add(types_1.HttpMethod.GET, args);
}
post(...args) {
return this.add(types_1.HttpMethod.POST, args);
}
put(...args) {
return this.add(types_1.HttpMethod.PUT, args);
}
patch(...args) {
return this.add(types_1.HttpMethod.PATCH, args);
}
del(...args) {
return this.add(types_1.HttpMethod.DEL, args);
}
trace(...args) {
return this.add(types_1.HttpMethod.TRACE, args);
}
head(...args) {
return this.add(types_1.HttpMethod.HEAD, args);
}
options(...args) {
return this.add(types_1.HttpMethod.OPTIONS, args);
}
connect(...args) {
return this.add(types_1.HttpMethod.CONNECT, args);
}
any(...args) {
return this.add(types_1.HttpMethod.ANY, args);
}
all(...args) {
return this.add(types_1.HttpMethod.ANY, args);
}
}
exports.default = AbstractRoutingParser;