I'm just starting out in Haskell and Yesod. To get my feet wet, I'm going to convert a small project that I wrote in MVC into Haskell. My first step was just to get all the routes defined.
All told, I have 8 handlers to make this project run. My routes file looks like this:
/activity ActivityR GET
/activity/#String ActivityItemR POST DELETE
/dashboard/month MonthDashboardR GET
/dashboard/year YearDashboardR GET
/calendar CalendarR GET
/events/calendar CalendarEventsR GET
/events/report ReportEventsR GET
/report ReportR GET
The flow I went through in adding these routes went like this:
- Add route to config/routes
- Create file in Handler folder (I created one for each route parent, e.g. /events or /dashboard)
- Add an import to the handler created in step #2 to Application.hs
- Add the handler file name to my project's cabal file
Is there a shortcut, or way to wildcard these handlers so that I could do something like Import Handler.*
Or is the preferred way to have fewer handler modules that handle multiple different routes?