Move middleware to server/middleware