electron nodejs with c++ class in backend

匆匆过客 提交于 2019-12-11 06:56:37

问题


I am fairly new to web development other than basic HTML5 website creation, I somehow understand the general structure but I still cannot understand fully especially electron and nodejs.

The other day I was going to create a webapp, which is similar to wysiwyg text editor but talks in between the browser (HTML5/js) with the backend (c++ script). What I first tried, was to have a c++ hello world script, which can be executed from the webapp built upon electron. I was able to run .exe as child_process but I couldn't get to further.

Now, I took myself a bit deeper research for looking into c/c++ addon from nodejs but still trying to understand. The basic examples on the nodejs doesn't seem to give me a full understanding on how to transfer data.

I'm sorry for the long paragraph to describe my status but in short, here are some questions:

  1. Can anyone give me an idea of how Electron/nodejs can be used as a browser-backend middle interface?
  2. Does anyone have a simple example / phedo-code with a propoer API use to talk in between nodejs-c++backend? Is nodejs c/c++ addon the only method ?

Thank you for reading! and I'll look forward anyone to help me understand.


回答1:


As you already figured out, Node.js offers the functionality you seek via its C/C++ Addons. Are you able to repoduce the basic callback example found at the Node.js API manual?



来源:https://stackoverflow.com/questions/37908639/electron-nodejs-with-c-class-in-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!