Add api index map, move routes functions all into namespace