@ebonydevcopy/framework
Version:
A module-based NodeJS chatbot framework.
36 lines • 854 B
JavaScript
;
/**
* ebony-framework
*
* @module routers/BasicRouter
* @author Christos Panagiotakopoulos <chrispanag@gmail.com>
* @copyright Copyright(c) 2020 Christos Panagiotakopoulos
* @license MIT
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A Basic Router Class
*/
class BasicRouter {
constructor() {
this.routes = {};
}
/**
* Adds routes to this router
*/
importRoutes(routes = {}) {
this.routes = Object.assign(routes, this.routes);
}
/**
* Checks if the route exists and if yes returns the function. If it doesn't exist it returns false
*/
getRoute(route) {
if (route in this.routes) {
return this.routes[route];
}
return false;
}
}
exports.default = BasicRouter;
//# sourceMappingURL=BasicRouter.js.map