Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion build_with_cmake/node-addon-api/hello.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#include <napi.h>


static Napi::String Method(const Napi::CallbackInfo& info) {
// Napi::Env is the opaque data structure containing the environment in which the request is being run.
// We will need this env when we want to create any new objects inside of the node.js environment
Napi::Env env = info.Env();
return Napi::String::New(env, "Hello, world!");

// Create a C++ level variable
std::string helloWorld = "Hello, world!";

// Return a new javascript string that we copy-construct inside of the node.js environment
return Napi::String::New(env, helloWorld);
}

static Napi::Object Init(Napi::Env env, Napi::Object exports) {
Expand Down