Add middleware file; Refactor categories routes