错误DATABASE_URI未指定,回退到localhost。在端口1337上运行的parse-server-example

时间:2016-07-29 11:26:04

标签: mongodb parse-platform

我目前正在将parse.com迁移到linode服务器(debian7)。 我想我已经正确地放置了mongo连接stringin index.js,但我仍然得到消息

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

这是我在localmachine

上安装解析时所做的root user
git clone https://github.com/ParsePlatform/parse-server-example.git
cd parse-servear-example
npm install

替换以下行

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
 serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://mongouser:PaSSwordD@100.100.200.200:27017/mydb',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'xxxxxxxxxxxxxxxxxxxx',
  masterKey: process.env.MASTER_KEY || 'xxxxxxxxxxxxxxxxxxx', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/',  // Don't forget to change to https if needed

启动parseserver ..

# npm start

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

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

1 个答案:

答案 0 :(得分:-1)

如果您正在使用parse-server-example index.js,那么您将在创建新ParseServer对象之上看到以下几行

var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
} 

您所看到的控制台线路输出来自哪里。