added a middleware

added middleware add user and msgs to req.locals