Reputation: 9
I have a working PHP based API that sends JSON-Data for Ajax requests.
I wonder if there is any way to call those PHP Files from NodeJS, maybe even by an Ajax Request, so i don't have to rewrite all my Code.
The PHP Server will alwasy be running, because the "normal" Page is based on it. But loading and saving should be managed by the NodeJS Server.
Upvotes: 0
Views: 2408
Reputation: 1764
You may use node.js request library for this - Examples are provided in - https://github.com/request/request
Your client side ajax code should direct to node.js application server and then from node.js server, you can send request through the above and on callback of the code,you will have the result, which you can return as response to your ajax callback...
Hope this will help you.
Upvotes: 2