2013-5-10-redis.md

Read more →

2013-5-10-redis2.md

Read more →

2013-5-10-redis3.md

layout: post category: lessons title: “自己搭建Node+Express+Redis的MVC框架(三)” tagline: “Supporting tagline” tags: [intro, beginner, jekyll, tutorial] 安装Express 安装express十分容易 npm install -gd express 执行express,生成MVC的框架 express blog cd blog npm install node app 打开http://127.0.0.1:3000/,你可以看到Express的Hello Word欢迎页面,表示Express已经成功运行。 使用coffee-script开驾驭Express require "coffee-script" http = require 'http' path = require 'path' express = require 'express' app = express() app.configure(-> app.set('port', process.env.PORT || 3000) app.use(express.logger('dev')) app.use(express.directory(__dirname + 'public')) app.use(express.static(path.join(__dirname, 'public'))) app.use(express.favicon()) app.set('views', __dirname + '/views') app.set('view engine', 'jade') app.use(express.bodyParser({keepExtensions: true, uploadDir: '.
Read more →

2013-5-10-redis4.md

Read more →

2013-5-10-redis5.md

layout: post category: lessons title: “自己搭建Node+Express+Redis的MVC框架(五)” tagline: “Supporting tagline” tags: [intro, beginner, jekyll, tutorial] 设计MVC Module数据模型 Redis Package vim package.json,在dependencies部分,增加Redis的内容,版本任意即可。 RON Package vim package.json,在dependencies部分,增加ron的内容,版本任意即可。 查看Ron的帮助文件,可以看到语法很简单 在routes下面建立module_users.coffee文件 在这个文件中,定义了我们需要的数据库模块 ron = require 'ron' client = ron port: 6379 host: '127.0.0.1' name: 'auth' Users = client.get 'users' Users.property id', {identifier: true} Users.property 'username', {unique: false} Users.property 'email', {unique: false} data = {username: 'ron', email: 'ron@domain.com'} Users.create data, (err, user)- > console.log(err, user.id) Users.
Read more →