This is just an idea for optimisation. No priority.
Instead of calling /api/v1/session and /api/v1/load_course in the beginning, we could easily inject this data into the JavaScript part of home.html, under flags.
Benefits
fewer initial HTTP requests, less code
The type of model.session would become Session instead of Maybe Session. This would get rid of all those cluttery case model.session of statements -> clearer code in a lot of places.
Downsides
Serving home.html would take slightly longer, since the server would first have to load data from the database, convert it to JS and inject it into the html.
the resulting HTML might grow large if we wanted to serve lots of data this way
Implementation time
This approach only works for HTML-based clients. If we also want to serve mobile clients, we still need the "old" API endpoint.
This is just an idea for optimisation. No priority.
Instead of calling
/api/v1/session
and/api/v1/load_course
in the beginning, we could easily inject this data into the JavaScript part ofhome.html
, underflags
.Benefits
model.session
would becomeSession
instead ofMaybe Session
. This would get rid of all those clutterycase model.session of
statements -> clearer code in a lot of places.Downsides
home.html
would take slightly longer, since the server would first have to load data from the database, convert it to JS and inject it into the html.Conclusion
Seems doable but hard to justify the effort.