What am I doing wrong, the custom controller retrieves data from an external source in json format but I cannot send it back in ctx.send. When I hit the endpoint it just returns Not Found.
The data is retrieved from the external source as it can be logged to the console but it can’t be returned to the GET request that triggers it.
@Gayrat is right. Because you are not using await, it just executes everything and exists with an empty result. So your request to TourCMS finishes AFTER you receive Not Found (that’s why you see the console log).
Thank @Gayrat I did try that, I have an issue then though accessing the ctx within the promise scope, see the below revised code which gives ‘Not Found’ when I hit the endpoint.
I can console.log the results of the promise but cant send it back as a response.