Moving middleware to api folder.