separate http server logic