使用淘宝NPM镜像

由于国内的网络原因,一些NPM的包无法通过默认的源进行下载。此时可以手动将安装源修改成淘宝的NPM镜像,方法如下:

npm config set registry="https://registry.npm.taobao.org"

基于Express的几款框架

Several popular Node.js frameworks are built on Express:

Feathers: Feathers is a minimalist, service-oriented, real-time web framework for modern applications.

ItemsAPI: Search backend for web and mobile applications built on Express and Elasticsearch.

KeystoneJS: Website and API Application F......

npm相关操作

Update npm

Node comes with npm installed.

First thing is to update npm:

[sudo] npm install npm@latest -g

or

npm install npm -g

Manage packages

List all the packages

npm ls

Install locally

npm install <package_name>

Install globally

npm install <package_name> -g......

nvm相关操作

Install nvmbrew update

brew install nvm

Then edit ~/.bashrc:

export NVM_DIR=~/.nvm

source $(brew --prefix nvm)/nvm.sh

Install nodenvm ls-remote

nvm install 4.5.0

nvm ls

nvm use 5.10.1

nvm alias default 4.5.0

Uninstall nodenvm uninstall 4.5.0

Event-driven asynchronous callbacks

Definition

In the execution model of PHP, the web server starts its own PHP process for every HTTP request it receives. If one of these requests results in the execution of a slow piece of code, other users requesting other pages would not be affected.

The execution model of Node.js is differen......