Nodejs Notes - newgeekorder/TechWiki GitHub Wiki
Node version management
- the n command https://github.com/tj/n can manage versions of node.
Node Api
- https://nodejs.org/api/ documentation including file, console, http, os, stream etc.
Testing
- http://unitjs.com/guide/quickstart.html
- mocha - simple, flexible, fun javascript test framework for node.js & the browser. (BDD, TDD, QUnit styles via interfaces) http://mochajs.org
Mocha running individual tests - using the grep option to select the tests
mocha -g "Else"
Building
- Gulp - is a streaming build file for node
- "Browserify lets you require('modules') in the browser by bundling up all of your dependencies." often used with gulp
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
gulp.task('browserify', function() {
return browserify('./src/javascript/app.js').bundle()
// vinyl-source-stream makes the bundle compatible with gulp
.pipe(source('bundle.js')) // Desired filename
// Output the file
.pipe(gulp.dest('./build/'));
});
Learning
Links and Ref
- Intelij Note: endure "File-> settings -> Languages and Settings -> Javascript -> Libraries" and ensure the nodejs libraries are included