leomorpho / goship

Opinionated Go/HTMX boilerplate with payments, emails, auth, notifications and more!⛵️
http://goship.run
MIT License
301 stars 12 forks source link

Create routenames pkg for better reusability #4

Closed leomorpho closed 1 month ago

leomorpho commented 1 month ago

Originally, route names were defined in routes package. That was problematic as the variables pointing to the string literals could not be used in templates, and hence we had to use the string literals in the templates. This increased friction on maintainability (one could change the string literal in the routes package and hence break any usage in the pages package (if not careful, which has happened to me before...).

Now, the route names can be used as routenames.X throughout the code, improving maintainability and decreasing the changes to inadvertently break old routes.