using middleware to reply