这就是我所做的,直接从http://docs.cloudfoundry.com/frameworks/nodejs/nodejs.html开始,为过时的文档做好准备:
$ vmc push vknodesample01
Instances> app.js
1: node
2: other
Framework> 1
1: node
2: node06
3: node08
4: other
Runtime> 1
1: 64M
2: 128M
3: 256M
4: 512M
5: 1G
6: 2G
Memory Limit> 1
Creating vknodesample01... OK
1: vknodesample01.cloudfoundry.com
2: none
URL> vknodesample01.cloudfoundry.com
Updating vknodesample01... OK
Create services for application?> n
Save configuration?> y
Saving to manifest.yml... OK
Uploading vknodesample01... OK
Using manifest file manifest.yml
Starting vknodesample01... OK
Checking vknodesample01... GAVE UP
Application failed to start.
$ cat app.js
$ cat app.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://example.com:1337/');
example.com实际上是一个二十七点0点0点1
我没有包含package.json文件,因为除非你有server.js,否则doc说你不需要它。
答案 0 :(得分:1)
我会取出环回地址,所以它看起来像这样......
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337);
部署时,我也会选择'node08'而不是'node'框架选项。