<ul><li> 1. Node: Getting Started </li><li> 2. Node Node Express Web </li><li> 3. Node Node ChromeJavaScript Web </li><li> 4. Node event-driven non-blocking I/O model single-threaded lightweight and efficient </li><li> 5. app.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Worldn'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/'); node app.js > Server running at http://127.0.0.1:1337/ </li><li> 6. REPL REPL( repple): Read-Eval-Print-Loop, a Nodejs shell. </li><li> 7. Node </li><li> 8. EventEmitter HTTP(S) File System Utilities : util.inherits(constructor, super), util.isArray(object), ... Socket, Stream (global) : process, Buffer, </li><li> 9. URL URI </li><li> 10. RESTful Web API REST (Representational State Transfer) HTTP PUT DELETE GET POST Express app.VERB() VERBHTTP app.get(), app.put(). Http Verb Route Intro GET /user/:id Id POST /create PUT /update/:id DELETE /delete/:id </li><li> 11. MongoDBdocument-oriented storage. MongoDBNoSQL db -> collection -> document Redisadvanced key/value store. Redis / </li><li> 12. MongoDB MongoDBBSONNode MongoDB 1. MongoDB Native Node.js Driver, MongDBNode 2. Mongoose, ORM(Object Relational Mapping) Mongoose Schema </li><li> 13. var HobbySchema = new Schema({ name: { type: String, required: true, trim: true } }); var UserSchema = new Schema({ id: { type: Number, required: true, trim: true, unique: true }, name: { type: String, required: true, trim: true }, birthday: Date, hobbies: [HobbySchema] }); var UserModel = model(UserModel, UserSchema); var lily = new UserModel({ id: lily, name: Lily Allen, birthday: new Date(2012, 11, 20), hobbies: ['reading', 'music'] }); </li><li> 14. mongoose mongoose.connect(mongodb://127.0.0.1/mydb); mongoose.connect('mongodb://username:passwor d@host:port/database?); mongoose.connection.on(open, function() { console.log(Connected to Mongoose); }); lily.save(function(err, data) { }); UserModel.find({id: 'lily'}, function(err, doc) { }); UserModel.update({id: 'lily'}, function(err, doc) { }); UserModel.remove({id: 'lily'}, function(err, doc) { }); </li><li> 15. Redis Redis /(key/value store). Redis MySQL Redis var client = redis.createClient(); var client = redis.createClient(host, port, options); </li><li> 16. (Middleware, http://en.wikipedia.org/wiki/Middleware) Connect (http://www.senchalabs.org/connect/)Node HTTPConnect10 favicon, logger, static, bodyParser, methodOverride... </li><li> 17. socket.io (http://socket.io/) Jade - template engine (http://jade-lang.com/) underscore (https://npmjs.org/package/underscore) url, path, querystring, ... </li><li> 18. http, path, fs, http.createServer(function(req, res) { // URL // // // // // }.listen('8124') </li><li> 19. Express Web Express Node, Web http://expressjs.com/ https://github.com/visionmedia/express </li><li> 20. Express Express </li><li> 21. 1. (site) > express site (Express 3.1.0) > express myapp create : myapp create : myapp/package.json create : myapp/app.js create : myapp/public create : myapp/routes create : myapp/routes/index.js create : myapp/routes/user.js create : myapp/views create : myapp/views/layout.jade create : myapp/views/index.jade create : myapp/public/stylesheets create : myapp/public/stylesheets/style.css create : myapp/public/javascripts create : myapp/public/images </li><li> 22. 2. > npm install -d 3. > node app </li><li> 23. package.json example: { "name": "nodeapp" , "description": "My first Node App." , "version": "0.0.1 , "author": "Madhusudhan Srinivasa (http://madhums.github.com)" , "scripts": { "start": "./node_modules/.bin/nodemon server.js" } , "dependencies": { "express": "latest" , "jade": "latest" , "mongoose": "latest" , "connect-mongo": "latest" } } package.json NPM http://package.json.nodejitsu.com/ http://blog.nodejitsu.com/npm-cheatsheet </li><li> 24. </li></ul>