What's the easiest way to run C code with Electron?


After reading about C++ Addons and browsing a little bit through the web, I created a basic binding.cpp file that looks like this:

#include <napi.h>

using namespace Napi;

String Hello(const CallbackInfo& info) {

return String::New(info.Env(), "world");


void Init(Env env, Object exports, Object module) {

exports.Set("hello", Function::New(env, Hello));


NODE_API_MODULE(addon, Init)

However, is this really what I need to do?


I don’t know if Electron has any special tools for running native code other than the ones Node comes with by default.