AndrewMcLagan
AndrewMcLagan

Reputation: 13987

Node, React web-server with a PHP api server

When communicating between a Node/React web server and a PHP api server is it best practice to "proxy" all requests by the client (React) through the web server and not directly to the api server?

Im using universal (isomorphic) React rendered on the Node web server. It would also use the api server to build the initial page loads (isomorphic).

Upvotes: 3

Views: 430

Answers (1)

François Richard
François Richard

Reputation: 7045

That's what I would do. Actually that's what i'm doing (with a java based backend/api). It allows you to hide the real structure of your api and also to eventually parse the result in the node server if needed. Also it allows you to adapt the request method to fit exactly your client services (if for example your api is not exactly sending the data the format and the way you want).

For me it seems to be a good practice (and I agree trying to close this question is crazy, this is a good question ...)

Upvotes: 1

Related Questions