Try*_*nJS 0 javascript frameworks express io.js
所以Node.js在去年年底分叉,分叉版本是io.js.
我在文档上找不到任何设置指南.我很新,有谁知道如何使用Express Web框架设置io.js?谢谢!
执行答案1中的步骤,然后像这样创建一个index.js文件
var express = require('express');
var app = express();
app.use('/resources', express.static(__dirname + '/resources'));
app.get('*', function (req, res, next) {
res.send('hello world');
res.end();
});
app.listen(3000);
Run Code Online (Sandbox Code Playgroud)
和这样的package.json
文件
{
"name": "iojsexpress",
"version": "0.0.0",
"description": "Get express working with iojs",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.10.7"
}
}
Run Code Online (Sandbox Code Playgroud)
然后运行以下命令
npm install
iojs index.js
Run Code Online (Sandbox Code Playgroud)
并在浏览器中访问localhost port 3000,你应该看到"hello world"