Add api index map, move routes functions into namespace