factor out method of creating router endpoints from kapi endpoints
fix pointer