This repository is the code for a blog series I wrote here. It's designed to outline a few ways to take legacy C++ (or new C++) and integrate it with Node.js.
First... get the code:
> git clone https://github.com/freezer333/cppwebify-tutorial.git
This is required for building all the C++ example projects, including the addons.
> npm install -g node-gyp
You can build all the projects from the CLI if you use grunt. If you don't want to install grunt, you can build all the projects individually (see step 3) instead.
> npm install -g grunt-cli
This tutorial includes 6 seperate C++ projects and one web (express) project. You'll only run the web app, but you need to build all the C++ apps. I've included a grunt script to take care of the entire build process (which is explained in the tutorial).
Go into the /web
directory and to build everything just type:
> npm install
which installs the web and grunt build dependencies... and then
> grunt
which build the C++ examples. If you want to remove the build artifacts (clean), just type:
> grunt cleanup
You need to got into each directory under /cpp
that has a binding.gyp file - which are the following:
/cpp/lib4ffi
/cpp/nodeprime
/cpp/nodeprime_sync
/cpp/standalone_flex_file
/cpp/standalone_stdio
/cpp/standalone_usr
And type npm install
inside each directory.
To run the web app, go to /web
and type npm install
as well.
The web app has links to invoke all the C++ examples. Just go to /web
and type:
> node index