Code Monkey home page Code Monkey logo

node-native-boilerplate's Introduction

Node Native Extension Boilerplate

Build Status

A very approachable node native extension.

This repository serves as a nearly minimal native extension built on Nan with enough tooling to also make it a great starting point for more complex projects.

Building

To compile the extension for the first time, run

$ npm i
$ npm run configure
$ npm run build

All subsequent builds only need npm run build

You can confirm everything built correctly by running the test suite.

Working With the Extension Locally

After building:

$ node
> var NativeExtension = require('./')
undefined
> NativeExtension.aString()
'This is a thing.'
> NativeExtension.aBoolean()
false
> NativeExtension.nothing()
undefined
> 

To run tests:

$ npm test

or to run test continuously

$ npm test -- watch

The Parts

File Contents
NativeExtension.cc Represents the top level of the module. C++ constructs that are exposed to javascript are exported here
functions.cc Example top-level functions. These functions demonstrate how to build and return various js types.
index.js The main entry point for the node dependency
binding.gyp Describes your node native extention to the build system (node-gyp). As you add source files to the project, you should also add them to the binding file.

node-native-boilerplate's People

Contributors

fcanas avatar jeffrey903 avatar tommoor avatar kkoopa avatar lgvo avatar panuhorsmalahti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.