3 ms·
In the examples, I used prefixes to demonstrate API versioning, but you're not limited to this approach. Prefixes can be used for general route structuring as w
by mr_Fatalyst 2y ago
In the examples, I used prefixes to demonstrate API versioning, but you're not limited to this approach. Prefixes can be used for general route structuring as well (like grouping entities, etc.), not just for versioning.
Personally, I prefer using router composition for flexible route organization. You can see a clear example of this with Flask here:
https://github.com/mr-fatalyst/fastopenapi/tree/master/examples/flask https://github.com/mr-fatalyst/fastopenapi/tree/master/examp...
In this example, routes are split into routers by entities, which are then grouped into an api_v1 router, and finally, this api_v1 router is added to the main router.