0

这就是我所做的,直接来自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

4

1 回答 1

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”而不是“节点”框架选项。

于 2012-12-14T15:46:17.617 回答