Controller-based routing - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Controller-based routing (297 Views)
| Controller-based routing by alapajs(op): 9:35pm On Feb 18, 2025 |
Controller-based routing in Alapa is designed to be intuitive. By following camel-case naming conventions for methods within a controller class, the framework automatically interprets the method names to generate corresponding routes. The first part of the method name specifies the HTTP verb, while the remaining parts define the route path, segmented by uppercase letters. https://alapa.dev/docs/routing/controller
|
| Re: Controller-based routing by Karleb(m): 7:40am On Feb 19, 2025 |
Controller based routing is a terrible idea. Imagine an app that has 200 routes, now you will have to go to each controller file to know which route actually exists. Please put your routes in a separate file. |
| Re: Controller-based routing by alapajs(op): 11:54am On Feb 19, 2025*. Modified: 6:14pm On Feb 19, 2025 |
Karleb:Thank you very much for your feedback, Karleb. I understand your concern about the complexity of managing routes in large applications. However, there are various tools and techniques in the Alapa framework that can help you view and manage your routes without having to manually navigate through each controller file. For instance, Alapa provides commands to list all defined routes in one place, which can save time and improve visibility. You can always group related routes. This way, your routing logic remains organized, and you can avoid the issue of searching through multiple controller files. In addition, Alapa offers different types of routing strategies apart from controller-based routing, such as Basic routing (similar to Express) and Resource-based routing. You can choose the approach that fits best for your application's structure and needs. To learn more about these routing options, check out the documentation here: https://alapa.dev/docs/routing/basic |
| Re: Controller-based routing by qtguru(m): 4:48pm On Feb 19, 2025 |
Karleb:Not always Spring boot and NestJS handles it just fine. Most controllers have a Base endpoint as long as you name it based on your controller, it should be easy to find. But putting in a file seems more organized, but I prefer the decorator approach |
| Re: Controller-based routing by bassdow: 3:00am On Feb 21, 2025 |
Karleb:or mayBe have the script autoGenerate the routes. Even Symphony and the likes sef, having to go through controller files just to know name of the route is somewhat a task atimes. |
| Re: Controller-based routing by MindHacker9009(m): 1:47pm On Feb 21, 2025 |
ASP.NET since year 2000 and now .NET Core: Provides greater flexibility, allowing developers to define complex and customized routing schemes as needed. While: Alapa: Offers simplicity with automatic route generation, which may be beneficial for standard CRUD operations. |
Resource-based Routing With Alapa • Need Help Testing Routing On This Site. • Dynamic Routing: Params & Query String In Node/express • 2 • 3 • 4
How I Streamed Arduino Sensor Readings In Real Time To The Power BI API Endpoint • Full Stack Website Developer • Web Developer/designer Needed