Skip to content

Commit 02af339

Browse files
davimacedoTomWFox
authored andcommitted
Improve GraphQL installation instructions (#642)
* Add using docker section * Add Using Express.js section * Add Running Parse Dashboard section * Update _includes/graphql/getting-started.md Co-Authored-By: Tom Fox <[email protected]> * Removing bulleted list for single notes * One more
1 parent e410ca4 commit 02af339

File tree

3 files changed

+85
-31
lines changed

3 files changed

+85
-31
lines changed

_includes/graphql/getting-started.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongo
1212

1313
Notes:
1414
* Run `parse-server --help` or refer to [Parse Server Options](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) for a complete list of Parse Server configuration options.
15-
* ⚠️ Please do not use `--mountPlayground` option in production as anyone could access your API Playground and read or change your application's data.
15+
* ⚠️ Please do not use `--mountPlayground` option in production as anyone could access your API Playground and read or change your application's data. [Parse Dashboard](#running-parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
1616

1717
After running the CLI command, you should have something like this in your terminal:
1818

@@ -21,3 +21,76 @@ After running the CLI command, you should have something like this in your termi
2121
Since you have already started your Parse GraphQL Server, you can now visit [http://localhost:1337/playground](http://localhost:1337/playground) in your web browser to start playing with your GraphQL API.
2222

2323
<img alt="GraphQL Playground" data-echo="{{ '/assets/images/graphql/graphql-playground.png' | prepend: site.baseurl }}"/>
24+
25+
## Using Docker
26+
27+
You can also run the Parse GraphQL API inside a Docker container:
28+
29+
```bash
30+
$ git clone https://github.com/parse-community/parse-server
31+
$ cd parse-server
32+
$ docker build --tag parse-server .
33+
$ docker run --name my-mongo -d mongo
34+
$ docker run --name my-parse-server --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test --mountGraphQL --mountPlayground
35+
```
36+
37+
After starting the server, you can visit [http://localhost:1337/playground](http://localhost:1337/playground) in your browser to start playing with your GraphQL API.
38+
39+
⚠️ Please do not use `--mountPlayground` option in production as anyone could access your API Playground and read or change your application's data. [Parse Dashboard](#running-parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
40+
41+
## Using Express.js
42+
43+
You can also mount the GraphQL API in an Express.js application together with the REST API or solo:
44+
45+
```js
46+
const express = require('express');
47+
const { default: ParseServer, ParseGraphQLServer } = require('parse-server');
48+
49+
const app = express();
50+
51+
const parseServer = new ParseServer({
52+
databaseURI: 'mongodb://localhost:27017/test',
53+
appId: 'APPLICATION_ID',
54+
masterKey: 'MASTER_KEY',
55+
serverURL: 'http://localhost:1337/parse'
56+
});
57+
58+
const parseGraphQLServer = new ParseGraphQLServer(
59+
parseServer,
60+
{
61+
graphQLPath: '/graphql',
62+
playgroundPath: '/playground'
63+
}
64+
);
65+
66+
app.use('/parse', parseServer.app); // (Optional) Mounts the REST API
67+
parseGraphQLServer.applyGraphQL(app); // Mounts the GraphQL API
68+
parseGraphQLServer.applyPlayground(app); // (Optional) Mounts the GraphQL Playground - do NOT use in Production
69+
70+
app.listen(1337, function() {
71+
console.log('REST API running on http://localhost:1337/parse');
72+
console.log('GraphQL API running on http://localhost:1337/graphql');
73+
console.log('GraphQL Playground running on http://localhost:1337/playground');
74+
});
75+
```
76+
77+
After starting the server, you can visit [http://localhost:1337/playground](http://localhost:1337/playground) in your browser to start playing with your GraphQL API.
78+
79+
⚠️ Please do not mount the GraphQL Playground in production as anyone could access your API Playground and read or change your application's data. [Parse Dashboard](#running-parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
80+
81+
## Running Parse Dashboard
82+
83+
[Parse Dashboard](https://github.com/parse-community/parse-dashboard) is a standalone dashboard for managing your Parse Server apps, including your objects' schema and data, logs, jobs, and push notifications. Parse Dashboard also has a built-in GraphQL Playground that you can use to play around with your auto-generated Parse GraphQL API. It is the recommended option for production applications.
84+
85+
The easiest way to run the Parse Dashboard is through its CLI:
86+
87+
```bash
88+
$ npm install -g parse-dashboard
89+
$ parse-dashboard --dev --appId APPLICATION_ID --masterKey MASTER_KEY --serverURL "http://localhost:1337/parse" --graphQLServerURL "http://localhost:1337/graphql" --appName MyAppName
90+
```
91+
92+
After starting the dashboard, you can visit [http://0.0.0.0:4040/apps/MyAppName/api_console/graphql](http://0.0.0.0:4040/apps/MyAppName/api_console/graphql) in your browser:
93+
94+
<img alt="Parse Dashboard GraphQL Playground" data-echo="{{ '/assets/images/graphql/dashboard-graphql-playground.png' | prepend: site.baseurl }}"/>
95+
96+
To learn more about Parse Dashboard and its setup options, please visit [Parse Dashboard Repository](https://github.com/parse-community/parse-dashboard).
Loading

package-lock.json

Lines changed: 11 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)