In this tutorial we gonna go through the basics on how to write a native add-on to NodeJS using C++, one of the platform's most powerful capabilities of which most web/JS developers now a days are not even familiar with.
We will create a very small and simple module which calculates the distance between two dots, it can do it either synchronously or asynchronously. The algorithm for calculating the distance between a given
pointB in a 2D Cartesian coordinate system looks like this:
√[(pointAX - pointBX)^2 + (pointAY - pointBY)^2]
We will start with a brief introduction for Google's v8 engine and some practical examples on how to use it, this will help us getting start, and then we will write our add-on. Let's begin then shall we?