completed route level middleware, as well as writing tests