摘要:1:第一步:安装"express-session": "~1.7.6"2:在app.js增加varsession=require('express-session');app.use(session({secret: 'ssshhhhh'}));app.use(function(req, res, ...
阅读全文
摘要:https://github.com/alsotang/node-lessons/tree/master/lesson2《学习使用外部模块》$ npm install express utility --save 这样可以把包保存在package.json中// 引入依赖var express = ...
阅读全文
摘要:1:怎样用layout.ejs在package.json里面的dependencies添加"express-partials": “*” 然后运行cmd并切换至项目目录运行npm install获得最新版。 app.js里面引用express-partials: 1 添加引用var partials...
阅读全文
摘要:1:$ npm install -g supervisor修改代码时不必总是重启服务,可以在浏览器刷新看到修改后的改变。用这个启动:$ supervisor app.js 或者supervisor ./bin/www2:创建和加载模块2.1:创建模块--一个文件就是一个模块//getmodule.j...
阅读全文
摘要:1:安装1:npm install express -g 如果不行 sudo npm install express -g2:npm install -g express-generator2:创建一个文件夹e:\cd mypro e:\mypro >express demo3:E:\mypro>e...
阅读全文
摘要:stream-handbookThis document covers the basics of how to write node.js programs with streams.You also could read a chinese editioncc-by-3.0node packag...
阅读全文
摘要:1:用单引号正确:var foo = 'bar'; 错误:var foo = “bar”;2:Your opening braces go on the same line as the statement.正确:if (true) { console.log('winning');}错误:if ...
阅读全文
摘要:Felix's Node.js Beginners GuideThis simple web server written in Node responds with "Hello World" for every request.var http = require('http');http.cr...
阅读全文
摘要:摘自王 群锋, 软件工程师, IBM http://www.ibm.com/developerworks/cn/web/1201_wangqf_nodejs/被误解的 Node.js如果经常浏览各大技术网站,那么你会发现自己很难错过 Node.js,程序员们兴奋地说:JavaScript 也可以开发...
阅读全文
摘要:摘自Michael Abernethy, 自由程序员, Freelancer http://www.ibm.com/developerworks/cn/opensource/os-nodejs/一个 “编码就绪” 服务器Node 是一个服务器端 JavaScript 解释器,它将改变服务器应该如何工...
阅读全文