middleware.js structure added