Cleanup

Some cleanup in the middleware.js file
Added an editorconfig to keep things consistent