Is it possible for an Laravel API to consume a Node API and that Node API to call that same Laravel API in a request?

Asked

Viewed 126 times

-2

I have a client (front-end) that consumes an endpoint in an Laravel API, this endpoint communicates with an API in Node.js and this API in Node.js calls Laravel API methods (which called the Node API), all this happening in a single request and this is not working properly, the request enters an "infinite loop" and it takes a long time to return something, when it returns gives an error on the Node:

TypeError: Converting circular structure to JSON

1 answer

1


You are basically making an infinite recursion, so if this is really necessary, try to put a base case so that at some point one does not need to call the other.

  • 1

    True Luis, I stopped to think and I could take this request of the Node that calls Laravel, thanks for the tip!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.