如何将Android应用程序连接到自托管的Parse.com服务器?

时间:2016-03-27 18:49:26

标签: android mongodb parse-platform amazon-ec2

我有来自GitHub project的MongoDB,Node.JS和Parse Server示例的Amazon EC2 Ubuntu实例。

我已将Parse.com迁移到实例上的MongoDB。它的地址是mongodb://usr:****@xxx.xxx.xxx.xxx:27017/euro

我已经在/var/www/parse中安装了GitHub中的Parse Server示例。
当我运行服务器时,我收到此消息:

$ cd /var/www/parse
$ npm run start

> parse-server-example@1.4.0 start /var/www/parse
> node index.js

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
Parse LiveQuery Server starts running.

我的问题是什么指向localhost?公共DNS?公共知识产权?

如何在Android应用中使用此代码连接服务器?

Parse.initialize(new Parse.Configuration.Builder(myContext)
    .applicationId("YOUR_APP_ID")
    .server("http://YOUR_PARSE_SERVER:1337/parse")
    .build()
);

当我尝试使用此地址http://ec2-xxx-xxx-xxx-xxx.compute-x.amazonaws.com:1337/parse(公共DNS)通过浏览器打开它时,我收到一条消息,指出连接已停止。

当我尝试使用此地址http://xxx.xxx.xxx.xxx:1337/parse(公共IP)通过浏览器打开它时,我收到一条消息,说连接已停止。

1 个答案:

答案 0 :(得分:0)

localhost127.0.0.1的别名。这是loopback的地址 它只能在本地访问。

维基百科上的

localhost

相关问题