workshopper / goingnative

A NodeSchool style workshopper for learning how to write native Node.js addons
MIT License
414 stars 54 forks source link

feat: add basic N-API exercises #90

Closed ccarruitero closed 4 years ago

ccarruitero commented 4 years ago

I'm adding new basic exercises (hello world like) using N-API and node-addon-api.

What do you think?

rvagg commented 4 years ago

This is a good step forward, +1. I think you should make it a little clearer in going_deep the difference in API:

Now you will learn how to use just N-API.

I know you've laid out the relationship in hello_napi but I think it's worth re-stating it in the inverse. I've seen a lot of people confused about the choice here and ultimately opt for the wrong option (IMO).

Something like:

Now you will learn how to use the N-API C interface directly, without the support of the node-addon-api C++ wrapper. Which approach you take in your own projects will depend on personal preference and the nature of the project, but it's worth understanding the difference.

As a longer-term future direction I'd also be +1 on evolving goingnative away from NAN entirely. N-API was intended to replace it and add stability and I think it's doing that job pretty well.

ccarruitero commented 4 years ago

Thanks @rvagg for your comment. I'll update the PR according that.

mhdawson commented 4 years ago

Will try to take a look but pretty busy with OpenJS World for the next couple of weeks.