Skip to content

Instantly share code, notes, and snippets.

Node.js Resources

What is node.js?

Node.js is just JavaScript running on the server side. That's it. That's all there is to it.

Express

  • Express Docs, if you want to get started and already know JavaScript this is the place to be
@micmath
micmath / beartrapJS.js
Created August 2, 2012 07:32
Examine the code snippet below, without evaluating it. What would you expect to be consoled?
MyApp = 42;
(function() {
if (typeof MyApp === 'undefined') {
var MyApp = { oops: true };
}
console.log(MyApp);
}());
@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@micmath
micmath / pattern1.js
Created October 31, 2011 23:28
Ways of documenting inner symbols inside anonymous functions that later get promoted to global
// Be explicit - provide names for everything.
(function(window) {
/**
* The ToolBox
*
* @class ToolBox
*/
var ToolBox = {};
/**