Tag: cloud9 ide

如何发送post请求到cloud9中的server.js

您好,我正在学习云9上的平均堆栈。 我已经到了试图将variables发送到我的node.js服务器的地步,但是我不确定我的服务器是否正在拾取它。 我的发布请求代码是否有明显的错误? app.js(前端angular) console.log('begin'); var http = new XMLHttpRequest(); var params = "text=stuff"; http.open("POST", "https://new-backup.splacorn.c9.io/myApp/server/server.js/", true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.onreadystatechange = function() { console.log('onreadystatechange'); if (http.readyState == 4 && http.status == 200) { alert(http.responseText); } else { console.log('readyState=' + http.readyState + ', status: ' + http.status); } } console.log('sending…') http.send(params); console.log('end'); 这是我得到的控制台响应: begin sending… end […]

如何访问cloud9中的localhost:9000 for Harp服务器(自定义工作区)?

我正在尝试使用harp server my-blog运行竖琴服务器,它在localhost:9000上提供。 我如何访问Cloud9? 我已经尝试了所有可用的解决scheme在networking上 http://workspace-user.c9users.io:9000 http://workspace.user.c9users.io:9000 甚至是使用mysql-cli的7位数字都没什么用处!

fs.readFileSync错误

我正在尝试使用html-pdf节点模块从html生成pdf。 我目前正在使用cloud9 IDE运行这个。 我的代码是: var fs = require("fs"); var pdf = require('html-pdf'); var html = fs.readFileSync('./test.html', {encoding: 'utf8'}); var options = { format: 'Letter' }; app.post('/pdf',function(req, res) { pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) { if (err) return console.log(err); console.log(res); // { filename: '/app/businesscard.pdf' } }); }); 我得到以下错误: [Error: Fontconfig warning: ignoring C.UTF-8: not a valid language […]

如何将RUN操作绑定到Cloud9中正确的NodeJS版本?

背景 我有一个非常sinmple nodejs应用程序使用ECMA6的对象破坏运算符 "use strict"; function bananas(){ return { type: "fruit", color: "yellow" }; } function eat(){ var { type, color } = bananas(); return `I eat ${type} colored ${color}`; } console.log(eat()); 问题 当我点击index.js的运行button(或者当你右键点击index.js然后select“运行这个文件”) 我得到以下错误: Debugger listening on [::]:15454 /home/ubuntu/workspace/server/index.js:16 var { ^ SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js […]

NodeJS应用程序的构build是成功的(Heroku),但在启动时,Heroku的应用程序错误

我正在使用Cloud 9 IDE。 当我做的时候,构build是成功的 git add . git commit -m "first_commit" git push heroku master 其结果是这样的: Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 280 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Compressing source files… done. […]

我可以从cloud9-ide运行nodeunit吗?

我想知道是否可以在Cloud9 IDE中运行nodeunittesting(就像我在Eclipse中运行JUnittesting一样)。 ps:我使用本地Cloud9 IDE,而不是来自c9.io 谢谢

在networking上使用cloud9-ide

我已经得到了cloud9 IDE,并使用最新的github代码和node.js 0.6.17在我的ubuntu上运行。 看来我可以在localhost:3131或127.0.0.1:3131上查看它,但是如果我试图用机器的实际IP地址查看它,无论是从另一台机器,甚至在同一台机器上,我得到一个“不发现“错误。 有什么办法让这个在networking上工作吗? (我读了有一个“-l”的命令行参数 ,可以让你这样做,但现在看起来没有效果。是否删除了这个function?何时以及为什么?)

Node.js https在Cloud9中不起作用

我可以创build一个http服务器,它工作正常,但只要我尝试使用https而不是服务器,运行没有错误,但我根本无法连接到它。 HTTP(工作): http.createServer(app).listen(process.env.PORT, process.env.IP); HTTPS(不工作): var options = { key: fs.readFileSync('server.key'), cert: fs.readFileSync('server.crt') }; https.createServer(options, app).listen(process.env.PORT, process.env.IP); 这两种方法都没有错误,但是当我使用HTTPS时,访问网页时没有响应,服务器甚至没有收到请求。 从Cloud9环境中使用的端口有问题吗? 我试了好几个小时才弄清楚是什么问题,但还没有取得任何进展,希望有人能帮忙。

我可以在strongloop中使用NodeMailer发送电子邮件吗?

我正尝试从strongloop发送电子邮件。 我在云端平台在线工作。 我试着用简单的代码来发送邮件。 但没有任何工作。

在“cloud9-ide”上运行的Node.js聊天服务器正在侦听,但无法使用客户端进行连接

聊天服务器正在监听端口,下面的代码片段来自控制台日志。 Your code is running at https://mynodetest-someone.c9.io. Important: use process.env.PORT as the port and process.env.IP as the host in your scripts! debugger listening on port 15454 info – socket.io started Chat server listening at 0.0.0.0:4000 当试图通过浏览器连接:例如:“localhost:4000”,连接被拒绝( 错误代码:ERR_CONNECTION_REFUSED) 有人可以帮助解决这个问题吗? 注意:我试过在“127.0.0.1”上进行监听,并给出了networking中的原始IP地址。