如何使用解析服务器创建应用程序? [英] How to create app with parse server?

查看:108
本文介绍了如何使用解析服务器创建应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在parse.com中,当我要创建新应用时,我使用:

In parse.com, when I want to create new app, I use:

curl -X POST \
-H "X-Parse-Email: <PARSE_ACCOUNT_EMAIL>" \
-H "X-Parse-Password: <PARSE_ACCOUNT_PASSWORD>" \
-H "Content-Type: application/json" \
-d '{"appName":"my new app","clientClassCreationEnabled":false}' \
https://api.parse.com/1/apps

但是当我将解析服务器部署到Heroku和Digital Ocean时,我不知道要创建新的应用程序,因为我的服务器没有PARSE_ACCOUNT_EMAIL和PARSE_ACCOUNT_PASSWORD.当我部署解析仪表板时,它没有像Parse.com这样的创建新应用".

But when I deployed Parse server to Heroku and Digital Ocean, I didn't know to create new app, because my server doesn't have PARSE_ACCOUNT_EMAIL and PARSE_ACCOUNT_PASSWORD. When I deployed parse dashboard, it didn't have "Create a new app" like Parse.com.

如何使用自托管的Parse服务器创建新应用?

How can I create new app with my self-hosted Parse server?

推荐答案

自托管解析服务器每台服务器只能处理一个应用程序,至少目前是这样. 这意味着您将必须使用多个Parse安装,每个安装使用多个应用程序使用一个应用程序,或者在同一台服务器上使用多个解析实例,但是将每个服务器配置为使用不同的端口.

The self hosted parse servers can only handle one app per server, at least for now. This means that you will have to use several installations of Parse, one app per installation using multiple servers or multiple instances of parse on the same server but configure each server to use different ports.

要回答您的问题:不,您不需要使用parse.com来创建新的应用程序. 要创建新应用,请在数字海洋或其他托管服务器上的解析配置/启动文件中设置appID和密码. appID和密码可以是您自己输入的任何内容,不需要来自parse.com.

To answer you question: No you do not need to use parse.com to create new apps. To create a new app you set the appID and password in the parse config/start file on your digital ocean or other hosted server. The appID and password can be anything that you make up, it does not need to be from parse.com.

以下是启动文件中的环境设置示例:

Below is an example of the environment settings in a startup file:

**Example file: ~/parse-server-example/my_app.js**

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

// Configure the Parse API
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/dev',
  cloud: __dirname + '/cloud/main.js',
  appId: 'myOtherAppId',
  masterKey: 'myMasterKey'
});

var app = express();

// Serve the Parse API on the /parse URL prefix
app.use('/myparseapp', api);

// Listen for connections on port 1337
var port = 9999;
app.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
});

然后使用以下命令运行文件:

Then run the file with:

node my_app.js

您可以在此处了解更多信息:

You can read more here: Parse Server at Digital Ocean

这篇关于如何使用解析服务器创建应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆