More advanced generic api route registering

Mad the api route registrering alto a bit more advanced in order to write less code later...