Automatic URL Routing
Trongate's URL routing system is designed to intuitively map URLs to specific application components based on a straightforward set of rules. This design allows URLs to directly influence which modules and methods are executed, streamlining the user navigation process.
Here are the rules that Trongate follows when attempting to automatically map website URLs to modules, classes and methods:
- First Segment: The first URL segment specifies the module to be loaded. Trongate assumes this is both the module and the class name within the module that needs to be accessed.
- Second Segment: This second URL segment is used to determine the method, within the specified class, that should be invoked.
- Third Segment: The third URL segment is entirely optional. If it exists, this segment is treated as an argument to be passed to the method identified in the second segment. This allows dynamic data to be passed directly through the URL
For example, consider the following URL:
https://example.com/members/profile/88
A URL that is constructed in this manner would:
- Load the 'members' module and instantiate the 'members' class.
- Invoke the 'profile' method.
- Pass the number '88' to the 'profile' method as an argument.
This segmentation method ensures that URL paths are not only easy to understand but also maintain a clean and efficient architecture for developers and users alike. It allows for flexible yet structured access to different parts of the application, supporting a wide range of functionalities from simple displays to complex data manipulation.
Trongate's automatic URL routing mechanism, as outlined above, may be superseded by other routing rules under certain conditions. This includes scenarios involving the Trongate API Manager or when custom URL routing configurations are activated.