Use Java Library directly in NodeJs
Viktor Turskyi (@WebbyLab)We write in JavaScript, but there are cases when the library we need is only in Java. In my practice, there was such a situation. I needed a Semgrex library from a Standford NLP parser. Semgrex is a library that allows you to apply regulars to select nodes from the sentence tree (google for dependency tree nlp).
Of course, you can write all the code in Java, but I would rather don't do that. Another option is to call Java from NodeJs.
Java provides the JNI (Java Native Interface), which gives us the ability to call Java methods from another language and for NodeJs there is an excellent module https://www.npmjs.com/package/java, which is a bridge to JNI.
As a result, you can easily use the Java classes inside your NodeJs application as if they were JavaScript classes.
As an example, you can take a look at the source code for nodejs wrappers around java Semgrex https://www.npmjs.com/package/semgrex