ITeye博客

Parse and Heroku Service(3)Parse Server and Parse Dashboard

sillycat · 2016-03-22 06:30 · Mobile Platform · 企业架构 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。