目的 | 描述 |
---|
Node.js | Express 4 需要 Node.js 0.10.x 或更高版本,并且已放弃对 Node.js 0.8.x 的支持。 |
http.createServer()
| 不再需要 http 模块,除非您需要直接使用它(socket.io/SPDY/HTTPS)。该应用程序可以使用 app.listen() 功能启动。 |
app.configure()
| app.configure() 功能已被删除。使用 process.env.NODE_ENV 或 app.get('env') 功能检测环境并相应地配置应用程序。
|
json spaces
| Express 4 中默认禁用 json spaces 应用程序属性。 |
req.accepted()
| 使用 req.accepts() 、req.acceptsEncodings() 、req.acceptsCharsets() 和 req.acceptsLanguages() 。 |
res.location()
| 不再解析相对 URL。 |
req.params
| 是一个数组;现在是一个对象。 |
res.locals
| 是一个函数;现在是一个对象。 |
res.headerSent
| 更改为 res.headersSent 。 |
app.route
| 现在以 app.mountpath 的形式提供。 |
res.on('header')
| 已移除。 |
res.charset
| 已移除。 |
res.setHeader('Set-Cookie', val)
| 功能现在仅限于设置基本 cookie 值。使用 res.cookie() 来增加功能。 |