Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Add routes to basic features included


Overview

Here are my notes on building Node.Js by JavaScript programming.

Platforms: Node on IoT

The “smallness” of Node makes it ideal for use on tiny operating systems for IoT. Node is now running on Raspberry Pi, etc.

This would require having V8 engines on devices, which takes up memory.

But the interpretive nature of Node would enable it to provide a larger and more varied app than compiled.

This is at risking slower parsing bottleneck.

IDE

Rob Conery recommends $49 WebStorms

Modularity by Framework

  • http://x2node.com/ is a complete but lightweight framework on various modules at
    https://github.com/boylesoftware
    that include mySQL, http://boylesoftware.com/blog/x2-framework-node-js

  • Plain JavaScript - Namespaces, Module Pattern, Class Pattern

  • AngularJs is a “one stop shop” for a variety of architectures
    • Modules, Services, Factories, Controllers, Directives
  • Backbone provides views in JavaScript - Namespaces and Objects. Full modules with Backbone.Marionette

  • Knockout focuses on data binding (routing, composition, dependency injection elsewhere)

  • EmberJs
    • Extend built-in objects or use ES6/Plain JS Modules
  • Durandal
    • Async Module Definition
  • Sails (as in MVC Rails) for Backbone SPA sites https://github.com/balderdashy/sails http://sailsjs.org/

  • Geddy

  • Koa (replacement for Express)

  • Meteor Intro to Meteor

Comparing Node.js Frameworks: Express, Hapi, LoopBack, Sailsjs and Meteor Feb 3 2015 by @shubhrakar at StrongLoop

[7:36] Express.js uses MongoDB OOTB.

  • http://stackoverflow.com/questions/17589178/why-should-i-use-restify restify.com supports SPDY.

API GraphQL

https://www.sitepoint.com/creating-graphql-server-nodejs-mongodb/

Babel for ES6

In index.js

require('babel/register');
require('./app');
   

CommonJS Compatible standard

EcmaScript 6 in NodeJs.

   var api = require('./api'); 
   

public interface facades:

   exports.getCities = function (cb){
      // ...
   }
   

Dependency management

http://RequireJs.org

Asynchronous Module Definition (AMD)

To define a dependency:

// aModule.js
define([], function(){
  function_init(){
    // ...
  }
  return {
    init: _init
  }
});
  

To use a dependency:

   require(["aModule","jQuery"],
     function (aModule, $){
        // use the dependencies
     }
   );
   

Metalanguages

Coffeescript

Coffeescript uses a simpler (another) syntax

Typescript

From Microsoft. Brings in type safety.

Dart from Google

Compiles to JavaScript

Avoiding Global Scope

  • Self-Executing Anonymouse Funcitons (SEAF)
  • Self-Invoking Anonymouse Functions (SIAF)
  • Immediately Invoked Function Expressions (IIFE)

Loading

http://github.com/rgrove/lazyload

http://bitl.comy/vswebessentials

JSLint

http://gruntjs.com

GruntJs

Testing tools

Smoke tests (canary) identify whether code deployed well so the environment is usable.

  • Jasmine from http://pivotal.github.io/jasmine/ behavior-driven development framework

  • Mocha

  • QUnit

Unit tests tests at granular code level.

UI tests (for User Acceptance Testing) uses tools such as Selenium to manipulate the UI to see the DOM output.

Integration tests testing pieces of several units at once.

Video Learning resources

Below are notes from the Pluralsight’s Node.js learning path series of classes.

Beginner classes

Intermediate classes

Advanced classes

Other Learning resources