Open fernandomema opened 11 months ago
AI-Generated Summary: This pull request introduces significant changes to the ZumitoFramework. A new class FrameworkRouter
is created and added to the framework to handle all routing related tasks.
The modifications include:
routes
from any
type to a Map type in the ZumitoFramework
class.FrameworkRouter
export to the index.ts
file. Additionally, the pull request also introduces the new FrameworkRouter
class which has a constructor
for setting up basePath
and an abstract method getRoutes()
.
In the Module
class, new methods registerRoutes()
and getRoutes()
are added for registering and fetching the routes respectively. Three new files are also created in the dist/types
and src/types
directories - FrameworkRouter.d.ts
, FrameworkRouter.js
and FrameworkRouter.ts
. These files contain the implementation details of the abstract class FrameworkRouter
.
Overall, these changes aim to improve the route handling capabilities of the framework.
Beta tag version created: 1.1.79.
You can install it with npm install zumito-framework@1.1.79
.
Reviewpad Report
:warning: Warnings
Beta tag version created: v1.1.72-dev-8752871829.0
.
You can install it with:
npm install zumito-framework@v1.1.72-dev-8752871829.0
Summary:
This Pull Request aims to enhance the ZumitoFramework by introducing user routing functionality, empowering developers to publish endpoints on their bot via an express server. The primary addition is the creation of a new class called
FrameworkRouter
, dedicated to be extended by developers who want to create new routesChanges Introduced:
FrameworkRouter
, has been added to the ZumitoFramework. This class is responsible for handling all routing-related tasks.FrameworkRouter
class is exported in theindex.ts
file for accessibility across the framework.FrameworkRouter
class includes a constructor for setting up abasePath
and an abstract methodgetRoutes()
, enhancing flexibility and customization.registerRoutes()
andgetRoutes()
, have been added to the Module class for registering and retrieving routes, respectively.Objective:
These modifications are geared towards improving the route handling capabilities of the ZumitoFramework. By introducing user routing functionality and refining the routing process, this Pull Request seeks to enhance the framework's flexibility and usability, ultimately empowering developers to build more robust and efficient bots.
Implementation
Here is an example of a route implementantion on a bot src/modules/general/routes/Example.ts