Tag: cloud9 ide

c9.io – 如何find在node.js平台上build立mysql连接的主机地址

我正尝试在Cloud 9 Server中托pipe我的node.js应用程序。 为了build立一个mysql连接,我需要知道主机地址。 这页在一个非常荒谬的说法(我认为我是对的)的方式: Hostname $IP The same local IP as the application you run on Cloud9 但是我从哪里获得本地IP? 没有在文档中find它。 任何想法 ? 编辑:我使用127.0.0.1,0.0.0.0(在回答中build议在terminalecho $IP )和hostname -I和curl curlmyip.com在terminal的值。 4个不同的IP地址。 没有工作。

Cloud9中的Mochatesting中的“未声明的variables”警告

我是node.js和unit testing框架Mocha的新手,但是我已经在cloud9 IDE中创build了一些testing,以了解它是如何工作的。 代码如下所示: var assert = require("assert"); require("should"); describe('Array', function(){ describe('#indexOf()', function(){ it('should return -1 when the value is not present', function(){ assert.equal(-1, [1,2,3].indexOf(5)); assert.equal(-1, [1,2,3].indexOf(0)); }); }); }); describe('Array', function(){ describe('#indexOf()', function(){ it('should return the index when the value is present', function(){ assert.equal(1, [1,2,3].indexOf(2)); assert.equal(0, [1,2,3].indexOf(1)); assert.equal(2, [1,2,3].indexOf(3)); }); }); }); 如果我在控制台中键入mocha,testing会起作用,但IDE会在“describe”和“it”的行中显示警告,因为它说variables没有被声明(“未声明的variables”)。 我想知道我应该怎么做这些testing来避免这些警告。 […]

Node.js jsdom错误

我正在试图让jsdom工作:) 代码如下: var jsdom = require("jsdom"); var request = require("request"); var fs = require('fs'); var jquery = fs.readFileSync("./jquery-1.7.2.js", 'utf-8'); request({ uri:'http://nodejs.org/dist/' }, function (error, response, body) { if (error && response.statusCode !== 200) { console.log('HTTP request error… '+error); } jsdom.env({ html: body, scripts: [ jquery ], done: function(errors, window) { console.log('done'); } }); }); 这里是错误: […]

如何连接到在cloud9服务器内部的'localhost'上运行的进程

我有一个Javascript项目,我在cloud9 IDE在线工作 ,我想用testem npm模块 :npmjs.org/package/testem和Mocha或Jasmine这样的库一起testing我的代码。 我正在关于net tuts +的这个教程 我已经安装了testem npm模块 ,但是当我在cloud9的terminal窗口中使用命令“ testem ”运行它时,testem要求我在“ localhost:7357 ”中打开一个新选项卡, 一般来说,预览cloud9中的工作区文件,我会去https://c9.io/username/folders…/workspace/folders…/index.html 由于我在cloud9服务器上,我想知道是否可以从浏览器打开这个“ 本地主机 ”链接,如果是,我该怎么做? (我在Cloud9的IDE里尝试了' localhost ',' 127.0.0.1 ',' 0.0.0.0 ',但是没有成功)。 也许我能以不同的方式访问它? 像“username.cl9.io/workspace:PORT”? 如果没有,也许有可能提供一个链接和端口testem(和任何一个机会怎么会这样做?)。 我知道在cloud9中你可以使用process.env.IP和process.env.PORT来提供给不同的模块,但不知道如何在浏览器中打开这样的文件。 任何帮助将不胜感激。

任何使用Cloud 9的Node.js教程?

我正在寻找无处不在希望find一个教程,告诉我如何使用云9来构buildNode.js应用程序。 任何人都知道有什么好的资源?

更新Cloud 9 IDE中的node.js版本

我的云9工作区正在运行Node.Js 0.10。 我怎样才能更新到最新版本的Node.Js(今天是0.12.4)? 我试图使用apt-get来安装Node.Js,但是我总是会得到0.10版本。 更新 :最新版本的云9工作区现在已经预装了4.1.1版本

validation我的node.js实例是开发还是生产

现在,无论何时我想将node.js服务器部署到生产服务器,我都需要更改所有IP / DNS /用户名/密码,以便连接到我的数据库和外部API。 这个过程是烦人的,有没有办法来validation当前正在运行的node.js实例是在cloud9ide还是实际上我的生产joyent smartmachine? 如果我能够(在我的运行代码中)运行我的node.js实例的服务器,我将添加一个条件,将值设置为prod或dev。 谢谢