Node for .NET Developers

August 2017

About Me

  • David Fekke
  • Chief Mobile Architect for Swyft Technology
  • Co-organize JaxNode and JaxARCSIG
  • Been in IT role since 1990
  • Web, Database, Backend Services and
    Mobile development
  • Commercial Pilot


  • Node.js User Group
  • Meet the third Thursday of each month

A brief History





Why learn Node.js

  • Makes Concurrency easy 
  • Microsoft heavily invested in Node.js
  • Broad cloud support from Amazon, Azure, IBM and Heroku
  • Client side tools built with or use Node.js
  • Solves the C10K problem
  • Take advantage of vast Module ecosystem
  • Single threaded and Asynchronous by default

You are already using Node

  • Microsoft active contributor to Node.js
  • Version of Node built on top of Chakra engine
  • Visual Studio uses it for client side dependencies
  • Gulp, Grunt and WebPack all use Node.js
  • Many Azure services built with Node.js
  • Mobile Central built with Node
  • Run .NET code in Node applications
  • Visual Studio Code built on top of Node.js

Misconceptions about JS

  • JavaScript is browser only *
  • JavaScript is slow *
  • Node.js is interpreted *
  • Not Object Oriented *

* None of these assumptions is true

The Truth

  • Node.js runs on top of V8 and libuv
  • Your code runs inside of a run loop
  • Node.js is event driven
  • Use clustering API to scale out your apps
  • Each process only requires 20MB of RAM

Atwood's Law

Any application that can be written in JavaScript, will eventually be written in JavaScript

Node used for

  • Web Frontend Development
  • Mobile Development Cordova, React-Native
  • Desktop Apps (Electron)
  • Backend Services (AWS, Heroku, Azure, IBM)
  • IoT Devices (Tessel 2, Galleo)
  • Microsevices and APIs

Types of Apps

  • Web Apps
  • Service Apps REST/JSON
  • MicroService Apps
  • Socket Apps
  • Command Line tools
  • Message Queue and Bus Apps
  • Desktop Apps with Electron
  • Mobile Apps

Module System

  • Units of functionality called Modules
  • hosts over 500000 modules
  • NPM command line tool to install
  • Two types, native addon and pure JS
  • Native modules extend V8s C++ framework
  • Modules stored in 'node_modules' sub folder
  • Import modules using require() function or import using ES module support


  • Used for configuration and meta information
  • npm init will create package.json
  • dependencies and devDependencies stored in this file

npm init

npm install

npm install module

npm install module --save

npm test

npm start

Useful NPM commands

walkthrough creating pkg.json

will grab your dependencies

installs individual module

installs includes in your dependencies

runs your unit tests

starts and runs your app

Package Clients

  • NPM comes bundled with Node
  • Yarn started last year as alternative, much faster
  • Bower built for client-side
// Example from
const http = require('http');

const hostname = '';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
}).listen(port, hostname, () => {
  console.log(`CodeImpact Server running at http://${hostname}:${port}/`);

Node Gotchas 

  • Duct type language
  • If Type system important TypeScript or Flow
  • == not the same as ===
  • Async, break work up in chunks
  • Be careful with floating point math
  • Avoid Callback hell
  • Debugging has been a challenge, but much better

Functional JS

Avoiding Callback Hell

  • Use named functions
  • Use Promises
  • Async/Await have been added to Node.js v8


  • JavaScript has many new language features
  • LTS versions of Node have most of these features
  • Babel and TypeScript transpilers allow almost all ES2016/17 features

Popular Frameworks

  • Socket.IO
  • Express
  • Hapi.js
  • Sails MVC
  • Seneca MicroServices

Alternative Engines

  • V8 default engine
  • V8 version 6 introduced new Interpreter and compiler, Ignition and Turbofan  
  • Microsoft open sourced ChakraCore engine in Edge browser
  • New Node bindings allow the JavaScript engine to be swapped out.
  • Can use 'nvs' to switch between engines and versions of Node.



  • Node Weekly


Contact Me

  • David Fekke at gmail dot com
  • Skype: davidfekke
  • Twitter: @davidfekke @jaxnode