Preparation:
1. NO-SQL
A) cradle: couchdb client for node. js
Https://github.com/cloudhead/cradle
npm install cradle
DEMO code:
var cradle = require('cradle');var connection = new(cradle.Connection)('http://localhost', 5984, { cache: true, raw: false});var db = connection.database('greeting');db.get('21a9674a8667843f61d333272c3e1f00', function (err, doc) { console.log(doc);});db.view('greeting/all', function (err, res) { res.forEach(function (row) { console.log("%s | %s", row.author, row.content); });});db.view('greeting/all', { descending : true }, function (err, res) { res.forEach(function (row) { console.log("%s | %s", row.author, row.content); });});
B. Mongoose: http://mongoosejs.com/
2. MVC Framework
Express: http://expressjs.com/guide.html
Railwayjs: http://railwayjs.com/
railway init blog && cd blognpm install -lrailway generate crud post title contentrailway server 8888open http://127.0.0.1:8888/posts
Towerjs: http://towerjs.org/
However, in windows, because node-WAF is required to install forever dependencies, cygwin or Linux is recommended.
npm install tower -g
tower new appcd apptower generate scaffold Post title:string body:text belongsTo:usertower generate scaffold User email:string firstName:string lastName:string hasMany:posts
Derbyjs: http://derbyjs.com/
Http://stackoverflow.com/questions/9897017/railwayjs-vs-towerjs
Unfinished, To be continued ......
References:
Http://blog.koostudios.com /? P = 398
Http://www.ianwootten.co.uk/2011/02/07/blog-rolling-with-couchdb-express-and-node-js