Extract http code out of main.go