add refactoring to allow api call in routing file