Cleanup

Some cleanup in the middleware.js file
Added an editorconfig to keep things consistent
This project utilises 2 spaces in code and JSON. No tabs are used anywhere in the codebase.