Moved some API stuff from web.go to api.go

Everything shouldn't be in web.go