---
title: "Parse and Heroku Service(3)Parse Server and Parse Dashboard"
author: "sillycat"
date: "2016-03-22T06:30:59Z"
tags: []
categories: ["企业架构"]
slug: "parse-and-heroku-service-3-parse-server-and-parse-dashboard"
draft: false
lastmod: "2016-03-22T06:30:59Z"
id: 2285318
url: "https://sillycat.iteye.com/blog/2285318"
---

Parse and Heroku Service(3)Parse Server and Parse Dashboard

1 Set Up ENV
Easiest way to start
> npm install -g parse-server

> npm install -g mongodb-runner

> parse-server --appId tester --masterKey tester

Not working on MAC, because of port number?
Unable to listen on port 1337. The port is already in use.

It works using other port.
> parse-server --appId tester --masterKey tester --port=2337
appId: tester
masterKey: ***REDACTED***
port: 2337
mountPath: /parse
maxUploadSize: 20mb
serverURL: http://localhost:2337/parse

parse-server running on http://localhost:2337/parse

Configuration Options
appId, masterKey,
databaseURI - format mongoldb://user:pass@host.com/dbname
port     format 2337
serverURL URL to Parse Server, the cloud codes will call these URLs.
cloud - The absolute path to our code main.js file.
push - https://github.com/ParsePlatform/parse-server/wiki/Push

Try to store data from REST API.
> curl -X POST \
> -H "X-Parse-Application-Id: tester" \
> -H "Content-Type: application/json" \
> -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
> http://localhost:2337/parse/classes/GameScore

{"objectId":"KHvvrHnXmW","createdAt":"2016-03-21T21:36:52.293Z"}

Once object is created, we can retrieve the object.
> curl -X GET \
> -H "X-Parse-Application-Id: tester" \
> http://localhost:2337/parse/classes/GameScore/KHvvrHnXmW

{"objectId":"KHvvrHnXmW","score":1337,"playerName":"Sean Plott","cheatMode":false,"updatedAt":"2016-03-21T21:36:52.293Z","createdAt":"2016-03-21T21:36:52.293Z"}

Other SDK to Parse
https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#using-parse-sdks-with-parse-server

In our project, we are using Parse Server + ExpressJS
https://github.com/ParsePlatform/parse-server

2 Parse Dashboard
https://github.com/ParsePlatform/parse-dashboard

Install the dashboard
> npm install -g parse-dashboard

This command works to connect the previous Parse Server
> parse-dashboard --appId tester --masterKey tester --serverURL "http://localhost:2337/parse" --appName tester

Options
port
config  for example, parse-dashboard-config.json

Start dashboard with a config file
parse-dashboard-config.json
{
     “apps”:[
          {
               “serverURL” : “http://localhost:2337/parse”,
               “appId”: “tester”,
               “masterKey”: “tester”,
               “appName”: “tester"
          }
     ]
}

Security the Dashboard
{
     “apps”:[…],
     “users”: [
          {
               “user”: “carl”,
               “pass”: “carl”
          }
     ]
}

References:
https://github.com/ParsePlatform/parse-server

https://github.com/ParsePlatform/parse-dashboard
