split server creation and api creation into seperate functions