Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Learning node.js by writing my own twitter client
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
models
public
test
views
README.md
app.js

README.md

README

Structure

Building a web-application involves multiple components.

The basic directory layout follows the MVC pattern

  • controllers
  • models
  • views

Static resources are served from the public directory.

  • express as a web development framework
  • mongoDB, a document-oriented database, as persistence layer
  • mongoose as database connector
  • ejs as very simple templating engine
  • expresso unit test

Lessons

Lesson 01

Install all stuff via

brew install mongodb
brew install node

# or via source
git clone https://github.com/joyent/node.git
cd node
./configure
make
make install

git clone http://github.com/isaacs/npm.git
cd npm
sudo make install

npm install express mongoose jade

Run database with

mongod run --config /usr/local/Cellar/mongodb/1.6.5-x86_64/mongod.conf
  • generate a skeleton app in the current dir by typing express
  • run tests with expresso

Lesson 02

  • added logging
  • added CRUD stubs
  • implemented GET messages, POST message (finding, saving with mongodb)
  • hardened test harness

Lesson 03

  • added view to GET messages
  • could not get partials call work with ejs. Switching to jade template engine
  • pushing and putting objects to mongodb via mongoose
  • installed futon4mongo as AdminUI for mongodb
  • its very hard to get things right. the docs and especially the tutorials aren't up to date. Getting the arguments of callback functions right is hard.

Resources

Mongoose mongoDB driver for node.js futon4mongo Ruby/Rack based Web UI for mongoDB

Something went wrong with that request. Please try again.