Nodejs
跳转到导航
跳转到搜索
Evented I/O for V8 javascript, 可以用来写服务器程序。
模块
使用环境变量 NODE_PATH 的值,比如 export NODE_PATH=/usr/local/lib/node_modules。
代码片断
捕获未处理的 Promise 异常
const util = require('util')
process.on('unhandledRejection', function(e) {
console.error('unhandled rejection %s: %s', util.inspect(e), e.stack)
process.exit(1)
})
信号的处理
nodejs 启动时会重置所有信号处理器为默认行为,除了
- 不管 SIGKILL 和 SIGSTOP
- 忽略 SIGPIPE
- 为 SIGINT 和 SIGEXIT 注册自己的处理器
代码位于 src/node.cc:4345 PlatformInit 函数中。
参见
- npm 包管理器
外部链接
- node.js主页
- node.js API
- Joyent Node,免费的 node.js hosting
- The Node Beginner Book » A comprehensive Node.js tutorial(有中文版)
- est's blog — Haskell, Ruby, Python, Nodejs如何把一个句子的词语倒序 (NodeJS 高级黑)
- Introducing the brand new nodejs-packaging
- The Mysterious Fiber Bomb Problem: A Debugging Story - Sandstorm Blog
- Profiling Node.js in Production