Home

Awesome

parse-server for Snowflake

Example project using:

Additional reading:

Test with your snowflake app

Steps to setup your own parse-server for Snowflake

Obtain a domain name

Signup for a free Mailgun account

Configure your domain name registrar to use Mailgun for email

Confirm Mailgun is ready to use email

Obtain Mailgun API Keys

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!'

Setup Heroku

Deploy

  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)
  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

Deploy parse-server locally

  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"

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

Test local parse-server with your snowflake app

  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
    } 		
  }
}

Deploy parse-server on Heroku

Test remote parse-server with your snowflake app

  backend: {
    hapiRemote: false,
    hapiLocal: false,
    parseRemote: true,
    parseLocal:  false
  },

Deploy parser-server-dashboard

  npm install
  "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