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
-
Introduction to Node.js 2h 48m 19 Dec 2012 by Paul O’Fallon
-
NPM Playbook Dec 11, 2015 58m by Joe Eames (@josepheames, joeeames.me, conference organizer)
Intermediate classes
-
Building Web Applications with Node.js and Express 4.0 4h 43m Dec 03, 2015 by Jonathan Mills
-
RESTful Web Services with Node.js and Express 2h 4m 13 Apr 2015 by Jonathan Mills
-
Large Scale Javascript 2h 49m 24 Jan 2014 by Shawn Wildermuth (@ShawnWildermuth)
EcmaScript6
Coffeescript uses a simpler syntax
Advanced classes
-
NodeJs Testing Strategies 2h 39m 13 Apr 2015 by Rob Conery
-
Node Application Patterns 2h 30m 10 Jul 2014 by Rob Conery
Makes use of cloud9.io IDE.
### Additional courses
-
Play by Play: Building a Node Web API by John Papa and Sam Artioli Beginner Jan 29, 2016 2h 1m
-
Integrating Node Applications with GitHub by Daniel Stern
-
Building Real-time Applications with Socket.io by Patrick Schroeder Aug 12, 2016 1h 13m
Other Learning resources
-
https://school.scotch.io/build-a-restful-nodejs-api/”> Build a Restfule NodeJs API</a> video intro is offered free. Subscribe for the MongoDB tutorial ($12/month).
-
High-Performance JavaScript: Why everything you’ve been taught is wrong by Joseph Smarr (at Plaxo)
-
Using Node.JS with Visual Studio Code Microsoft Virtual Academy