added global error handler

resolves #1
added csrf middleware

currently used after all other middlewares