Parse Server (http://parseplatform.github.io/) for React Native Snowflake project (https://github.com/bartonhammond/snowflake)
Example project using:
Additional reading:
https://github.com/bartonhammond/snowflake
parseRemote: true
hapiRemote: false
, hapiLocal: false
, parseLocal: false
appId: snowflake
masterKey: myMasterKey
url: http://snowflake-parse.herokuapp.com/parse
https://www.namecheap.com
)https://mailgun.com/signup
Domains
in the upper menu barAdd New Domain
and enter your custom domain nameDomain Verification & DNS
TXT
and MX
records.Namecheap
in this example)Domain List
from the left menu barManage
Advanced DNS
https://help.mailgun.com/hc/en-us/articles/202052074-How-do-I-verify-my-domain-
TXT
record from Mailgun, the one with value that starts with v=spf1
, however use @ as the host name instead of using your actual custom domainTXT
record from Mailgun, the one with value that starts with k=rsa;
, however, use smtp._domainkey.
(i.e. don't append your custom domain). Don't forget to include the trailing .
MX
records, but use @
as the hostname in both casesCNAME
record in this example, as this is used for email tracking purposes onlyDomains
in the upper menu barDomain Verification & DNS
Check DNS Records Now
Current Value
field matches the Enter This Value
field for both TXT
and both MX
recordshttps://help.mailgun.com/hc/en-us/articles/202052074-How-do-I-verify-my-domain-
Security
from the dropdownAPI Keys
tabActive API Key
Here's sample curl code for sending an email using your custom domain:
curl -s --user '<Active API Key>' \
https://api.mailgun.net/v3/samples.mailgun.org/messages \
-F from='Snowflake Server <info@<your-domain-name>' \
-F to='<enter the receiving email address>' \
-F subject='Hello' \
-F text='Testing some Mailgun awesomeness!'
App_Name
-- this must be unique across all heroku apps (or let Heroku pick name for you) PARSE_MOUNT: Accept the default (`parse`)
APP_ID: Must match <appId> from the snowflake react-native src/lib/config.js file
MASTER_KEY: Must match <masterKey> from the snowflake react-native src/lib/config.js file
SERVER_URL: Replace 'yourappname' to match your Heroku 'App_Name' (http://<yourappname>.herokuapp.com/parse)
parse-server
:
Settings
in the upper menu barReveal Config Vars
Key
and Value
pairs: MONGODB_URI: This variable is created automatically for you -- don't modify its value
APP_NAME: Choose the app name you want to appear in email confirmation & password reset and emails
MAILGUN_API_KEY: Must match Mailgun `Active API Key`
MAILGUN_DOMAIN: Must match your <custom domain name>
MAILGUN_FROM_ADDRESS: Use <anything>@<custom domain name>
VERBOSE: Set to true so Heroku keeps detailed logs
./setenv-example
to ./setenv
source ./setenv
which will setup the environment properly./setenv
filenpm start
, the ./setenv
file is sourced export APP_ID= "<same as above>"
export APP_NAME="<same as above>"
export MAILGUN_API_KEY="<same as above>"
export MAILGUN_DOMAIN="<same as above>"
export MAILGUN_FROM_ADDRESS="<same as above>"
export MASTER_KEY="<same as above>"
export MONGODB_URI="<same as above>"
export PARSE_MOUNT="<same as above>"
export SERVER_URL="http://localhost:1337/parse"
npm install
from your parse-server-example
project directorynpm start
to start parse-server
Example request to a server running locally:
curl -X POST \
-H "X-Parse-Application-Id: <APP_ID>" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore
curl -X POST \
-H "X-Parse-Application-Id: myAppId" \
-H "Content-Type: application/json" \
-d '{}' \
http://localhost:1337/parse/functions/hello
https://github.com/bartonhammond/snowflake
module.exports = {
SESSION_TOKEN_KEY: 'SESSION_TOKEN_KEY',
backend: {
hapiRemote: false,
hapiLocal: false,
parseRemote: false,
parseLocal: true
},
PARSE: {
appId: <APP_ID>, // must match `APP_ID` environmental variable
masterKey: '<MASTER_KEY>', // must match `MASTER_KEY` environmental variable
local: {
url: '<LOCAL_SERVER_URL>', // must match *local computer's* `SERVER_URL` environmental variable
},
remote: {
url: '<REMOTE_SERVER_URL>' // must match *heroku's* SERVER_URL environmental variable
}
}
}
node --version
https://devcenter.heroku.com/articles/heroku-command-line#download-and-install
heroku login
remote
to Heroku
heroku git:remote -a <Heroku_App_Name>
git push heroku master
backend: {
hapiRemote: false,
hapiLocal: false,
parseRemote: true,
parseLocal: false
},
https://github.com/ParsePlatform/parse-dashboard#getting-started
npm install
package.json
file by adding the following two lines in the existing scripts
section: "scripts": {
"local": "node ./Parse-Dashboard/index.js --appId snowflake --masterKey myMasterKey --serverURL http://localhost:1337/parse",
"remote": "node ./Parse-Dashboard/index.js --appId snowflake --masterKey myMasterKey --serverURL https://snowflake-parse.herokuapp.com/parse"
}
npm run local
npm run remote