refactors server endpoints into api/*