I do similar with Mojolicious, but have less of a defined difference between API/JSON routes and HTML routes, having grown the webapp organically for four years or so now. Unfortunately it started as a Mojolicious::Lite app, and the singe routes+logic controller file ballooned to 4k lines (sans templates and copious DBIC modules with custom methods) before I started forcing time to refactor them into separate modules like you've outlined above. I'm about 30% done but the usability (development wise) and maintainability increase is phenomenal.
To be clear, Mojolicious advises a layout like above from the beginning for any serious app (and even provides a utility to automatically convert Mojolicious::Lite apps, for the most part), but when it's in production already and Mojolicious lite makes it a little too easy to put that off when it's so easy to just add another route... Well, I have only myself to blame. :/
I'm really interested in well designed route structures,especially for sites that include both HTML and JSON variants of their data. It's API design any way you look at it, which is always a hard problem, but I haven't come up with general rules that I'm quite happy with yet. Guides or example sites are welcome.
To be clear, Mojolicious advises a layout like above from the beginning for any serious app (and even provides a utility to automatically convert Mojolicious::Lite apps, for the most part), but when it's in production already and Mojolicious lite makes it a little too easy to put that off when it's so easy to just add another route... Well, I have only myself to blame. :/
I'm really interested in well designed route structures,especially for sites that include both HTML and JSON variants of their data. It's API design any way you look at it, which is always a hard problem, but I haven't come up with general rules that I'm quite happy with yet. Guides or example sites are welcome.