Refactor database querying
- Add support for (semi-)automatic SQL generation using squel.js.
- Create a module/class to make the queries to the database. Currently, for every route the same code is replicated to make the query against the database. Since that code is pretty much the same in each route, there is a good potential for a rewrite as a module/class, preferably using Promises.