c a n d l a n d . n e t

Node JS Notes

Dusty Candland | | expressjs, javascript, mongodb, nodejs

Getting Node Setup

Node JS

How To Node

Download the latest package from Node JS

tar -vxzf node-v0.2.6.tar.gz

cd node-v0.2.6

./configure
make
make install

Package Manager

How To Node NPM

Hosting

NodeFu

Express

npm install express
npm install connect
npm install jade

Get the express samples to see how things work

git clone https://github.com/visionmedia/express.git

If you follow the hello world example, you might see the following error

node.js:63
    throw e;
    ^
Error: session requires the "secret" option string for security
    at Object.sessionSetup (/usr/local/lib/node/.npm/connect/0.5.5/package/lib/connect/middleware/session.js:45:13)
    at Server.<anonymous> (/Users/dustycandland/projects/smsbet/app/app.js:18:19)
    at Server.configure (/usr/local/lib/node/.npm/express/1.0.3/package/lib/express/server.js:332:8)
    at Object.<anonymous> (/Users/dustycandland/projects/smsbet/app/app.js:12:5)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at Object.runMain (node.js:522:24)
    at Array.<anonymous> (node.js:756:12)
    at EventEmitter._tickCallback (node.js:55:22)

FIX: add the { secret: 'some random text' } to the app.js configure section

app.use(express.session({ secret: 'some random text' }));

Links

Hearding Code Podcast

How To Node NPM

Mongo DB OSX Install

Mongo DB with Express

Express JS

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: