nodejs family使用纪要

【声明】本文为AdamsLee原创,转载请注明出自围炉网并保留本文有效链接:nodejs family使用纪要, 转载请保留本声明!

express mvc

angular mvc    (前端路由)

ejs, jade 模板

connect 中间件 http处理

bootstrap 前端开发的开源工具包


yeoman: create a new webapp. yo webapp; yo angular   (angular, webapp 脚手架)

bower handle dependencies  前端包管理. bower search; bower install

grunt  preview,test, build ->maven. grunt server; grunt test

grunt 使用 load-grunt-config ,如果有grunt/aliases.(js|.json|yaml|coffee) 会使用它来定义tasks 

http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it’s simple and hackable enough to be used for testing, local development, and learning.

http-server depends on ecstatic

ecstatic:A simple static file server middleware that works with both Express and Flatiron

how to use package.json?

nodejs dev box setup:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js             (to install latest nodejs)
sudo apt-get update
sudo apt-get install nodejs

sudo apt-get install npm

sudo npm install express -g

if encounter error: failed to fetch from registry: express

run " npm config set registry " before "npm install express"

npm install -g express安装最近版本的express.
   发现express -V命令不可用。
npm install -g express-generator
运行express -V
输出 4.2.0


When you get error like these when installing trough npm:

npm ERR! Error: EACCES, mkdir '/home/robkorv/tmp/npm-4098-5_3UI0mX'
npm ERR!  { [Error: EACCES, mkdir '/home/robkorv/tmp/npm-4098-5_3UI0mX']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/robkorv/tmp/npm-4098-5_3UI0mX' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

Use this:

sudo chown -R $USER:$GROUPS ~/tmp

PORT=8080 NODE_ENV=development node app.js

npm start    vs     node app.js

Anyhow, what really happens is that npm looks in your package.json file, and if you have something like
"scripts": { "start": "coffee" } }
then it will do that. If npm can’t find your start script, it defaults to:
node server.js

通过node启动程序,每次代码修改都需要重新启动。 有一个工具supervisor,每次修改代码后会自动重启,会我们开发省很多的时间。
npm install supervisor

sudo npm install supervisor -g

sudo npm install -g bower

sudo apt-get install git

bower install bootstrap

sudo npm install -g yo

sudo npm install -g generator-famous

sudo npm install -g grunt-cli

yo famous

sudo npm install

sudo npm install grunt

eclipse nodejs

Error: listen EADDRINUSE  (node 已占用端口)

ps ax | grep node

killall -9 node

private npm registry and web for company :

1.  alipay

2.  couchdb