Quote:
how to send and receive data from my c++ app to node.js server.
If the Node.js process and C++ program are on the same machine, then perhaps an IPC might help you. What you can do is you can use the local sockets and make Node.js listen on a socket—UNIX Sockets for instance.
Can node.js listen on UNIX socket? - Stack Overflow[
^]
What can be even better approach for this—and possible in case your processes are not on the same machines, such as client-server model—then you can utilize the networking APIs of C++, and send the request to Node.js process. Check out this article to learn a bit more on this topic,
Socket Programming in C++ using boost.asio: TCP Server and Client[
^]. Last but not least,
Quote:
i need to send it as application/json
This requires that you understand that JSON document itself is of a specific format, you cannot just make a string and assume it to be a JSON document.
Check out what a JSON document is,
JSON[
^]. But, one thing is for certain, a JSON document is still a string. So in C++ program you only need to
POST
a string and on Node.js you can capture that from the
request body.