Parse Server Example

Parse Server Example

Install parse-server, mongodb-runner

$ npm install -g parse-server mongodb-runner

// if mongodb is not installed, it will install it.
$ mongodb-runner start
Downloading mongodb-osx-x86_64-3.2.9.tgz  
[============================================>] 100.0% of 66.51 MB (264.17 kB/s)
✔  Downloaded MongoDB 3.2.9
  ◠ Starting a MongoDB deployment to test against...%
➜  nino git clone https://github.com/ParsePlatform/parse-server-example.git
Cloning into ''parse-server-example''...  
remote: Counting objects: 304, done.  
remote: Total 304 (delta 0), reused 0 (delta 0), pack-reused 304  
Receiving objects: 100% (304/304), 70.75 KiB | 14.00 KiB/s, done.  
Resolving deltas: 100% (144/144), done.  
Checking connectivity... done.  

Install node dependencies

Install dependencies:

➜  parse-server-example git:(master) npm install

添加masterkey:

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 || ''myMasterKey'', //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
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  }
});

Start Server

Start MongoDB:

➜  parse-server-example git:(master) ✗ mongodb-runner start

Start Parse Server:

➜  parse-server-example git:(master) ✗ npm start

> parse-server-example@1.4.0 start /Users/its/Project/nino/parse-server-example
> node index.js

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

Visit http://localhost:1337/test

Parse Dashboard

➜  ~ npm install -g parse-dashboard
➜  ~ parse-dashboard --appId myAppId --masterKey myMasterKey --serverURL "http://localhost:1337/parse"

Reference