Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript program makes use of programs in other languages [closed]

I have a javascript/typescript programs that need to make use of existing libraries written in Java, C and C++, python, etc.

What is the best way to facilitate the communication?

What I can think of is to implement each of them as different Web services on local computer. Is there other ways that can reduce overhead of communication, and reduce the effort making the communication possible (like wrapping them in services)?

like image 777
william007 Avatar asked Nov 25 '25 13:11

william007


2 Answers

There are a number of options to glue the different libraries together:

  1. Bridge modules that let you call the libraries directly from Node:

    • node-java
    • node-python
    • Edge for c#
    • NaN for C/C++
  2. Message queue that will serve as the bus between the different applications like 0MQ or RabbitMQ

  3. Wrap each program/library as a web service (as you suggested)

like image 184
Ofer Herman Avatar answered Nov 28 '25 04:11

Ofer Herman


If your TypeScript script runs in NodeJs, then you can run an external process using Node's Child Process.

If your TypeScript script runs in a browser, then an HTTP request is the most easy way.

like image 26
Martin Vseticka Avatar answered Nov 28 '25 02:11

Martin Vseticka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!