Use middlewares for scripts