server: rewrite using class-based views
This allows for a more in-depth refactor of the logic in each view. We
can create views that simply override a specific behavior of some
generic views, instead of having to write ugly spaghetti code in the
form of nested functions that return other parametrized functions.