简体   繁体   中英

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).

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 ...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM