Updated router to allow for a factory to be passed into the router for generating requests and responses.