Add event emitter to middleware and refactor csrf
Remove console.log
Add additional tests for csrf