Created factory for handling server requests