简体   繁体   中英

Communication between 2 projects in Node.js

I am a very beginner in NodeJS so my question can appear very simple but I've downloaded 2 kinds of programs (basically a first program that generate data and something that displays in another way the information) and I want to "connect them". The first works using client/server JS/Node.js and the display program works using client/server JS/Node.js but I launch them separately. But I want informations extracted from the first program are sent to the other program. It is surely possible but I don't know how to pass information from a program to another simultaneously when Node is used ? Can you give me a piece of advice of what concept I should study to do it. Thanks

Web apps consist of a client (code send to the user's browser) and an API which is how the client communicates with the server.

The code you downloaded probably uses a REST API. Most node projects are built using an existing web server framework line Express, which will hold the API information in some top level file under the server directory. To get the two servers to communicate, you can make requests (a standard library to use would be axios) from one server to the other server.

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