Skip to content

Commit 0711c28

Browse files
authored
Running graphQL (#1139)
* Add graphQLServerURL option to the CLI * Add GraphQL Playground instructions in readme file * Fixing typo * Including GraphQL link in summary * Changing order
1 parent 01232a6 commit 0711c28

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

.github/graphql-playground.png

82.2 KB
Loading

Parse-Dashboard/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const program = require('commander');
1616
program.option('--appId [appId]', 'the app Id of the app you would like to manage.');
1717
program.option('--masterKey [masterKey]', 'the master key of the app you would like to manage.');
1818
program.option('--serverURL [serverURL]', 'the server url of the app you would like to manage.');
19+
program.option('--graphQLServerURL [graphQLServerURL]', 'the GraphQL server url of the app you would like to manage.');
1920
program.option('--dev', 'Enable development mode. This will disable authentication and allow non HTTPS connections. DO NOT ENABLE IN PRODUCTION SERVERS');
2021
program.option('--appName [appName]', 'the name of the app you would like to manage. Optional.');
2122
program.option('--config [config]', 'the path to the configuration file');
@@ -47,6 +48,7 @@ let explicitConfigFileProvided = !!program.config;
4748
let configFile = null;
4849
let configFromCLI = null;
4950
let configServerURL = program.serverURL || process.env.PARSE_DASHBOARD_SERVER_URL;
51+
let configGraphQLServerURL = program.graphQLServerURL || process.env.PARSE_DASHBOARD_GRAPHQL_SERVER_URL;
5052
let configMasterKey = program.masterKey || process.env.PARSE_DASHBOARD_MASTER_KEY;
5153
let configAppId = program.appId || process.env.PARSE_DASHBOARD_APP_ID;
5254
let configAppName = program.appName || process.env.PARSE_DASHBOARD_APP_NAME;
@@ -87,6 +89,9 @@ if (!program.config && !process.env.PARSE_DASHBOARD_CONFIG) {
8789
]
8890
}
8991
};
92+
if (configGraphQLServerURL) {
93+
configFromCLI.data.apps[0].graphQLServerURL = configGraphQLServerURL;
94+
}
9095
if (configUserId && configUserPassword) {
9196
configFromCLI.data.users = [
9297
{
@@ -104,8 +109,8 @@ if (!program.config && !process.env.PARSE_DASHBOARD_CONFIG) {
104109
};
105110
} else {
106111
configFile = program.config;
107-
if (program.appId || program.serverURL || program.masterKey || program.appName) {
108-
console.log('You must provide either a config file or required CLI options (app ID, Master Key, and server URL); not both.');
112+
if (program.appId || program.serverURL || program.masterKey || program.appName || program.graphQLServerURL) {
113+
console.log('You must provide either a config file or other CLI options (appName, appId, masterKey, serverURL, and graphQLServerURL); not both.');
109114
process.exit(3);
110115
}
111116
}

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Parse Dashboard is a standalone dashboard for managing your [Parse Server](https
1919
* [Multiple apps](#multiple-apps)
2020
* [Single app](#single-app)
2121
* [Managing Multiple Apps](#managing-multiple-apps)
22+
* [GraphQL Playground](#graphql-playground)
2223
* [App Icon Configuration](#app-icon-configuration)
2324
* [App Background Color Configuration](#app-background-color-configuration)
2425
* [Other Configuration Options](#other-configuration-options)
@@ -136,6 +137,56 @@ Managing multiple apps from the same dashboard is also possible. Simply add addi
136137
}
137138
```
138139

140+
## GraphQL Playground
141+
142+
Parse Dashboard has a built-in GraphQL Playground to play with the auto-generated [Parse GraphQL API](https://github.com/parse-community/parse-server#graphql).
143+
144+
You can setup the GraphQL Playground by passing the `--graphQLServerURL` option to the `parse-dashboard` CLI:
145+
146+
```
147+
parse-dashboard --dev --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --graphQLServerURL "https://example.com/graphql" --appName optionalName
148+
```
149+
150+
The `graphQLServerURL` option is also available through an environment variable called `PARSE_DASHBOARD_GRAPHQL_SERVER_URL`:
151+
152+
```
153+
HOST: "0.0.0.0"
154+
PORT: "4040"
155+
MOUNT_PATH: "/"
156+
PARSE_DASHBOARD_SERVER_URL: "http://localhost:1337/parse"
157+
PARSE_DASHBOARD_GRAPHQL_URL: "http://localhost:1337/graphql"
158+
PARSE_DASHBOARD_MASTER_KEY: "myMasterKey"
159+
PARSE_DASHBOARD_APP_ID: "myAppId"
160+
PARSE_DASHBOARD_APP_NAME: "MyApp"
161+
```
162+
163+
You can also setup the GraphQL Playground in your `parse-dashboard-config.json` file:
164+
165+
```json
166+
{
167+
"apps": [
168+
{
169+
"serverURL": "http://localhost:1337/parse",
170+
"graphQLServerURL": "http://localhost:1337/graphql",
171+
"appId": "myAppId",
172+
"masterKey": "myMasterKey",
173+
"appName": "My Parse Server App"
174+
},
175+
{
176+
"serverURL": "http://localhost:1337/parse2",
177+
"graphQLServerURL": "http://localhost:1337/graphql2",
178+
"appId": "myAppId",
179+
"masterKey": "myMasterKey",
180+
"appName": "My Parse Server App 2"
181+
}
182+
]
183+
}
184+
```
185+
186+
After starting the dashboard, you can visit http://0.0.0.0:4040/apps/MyTestApp/api_console/graphql in your browser:
187+
188+
![Parse Dashboard GraphQL Playground](.github/graphql-playground.png)
189+
139190
## App Icon Configuration
140191

141192
Parse Dashboard supports adding an optional icon for each app, so you can identify them easier in the list. To do so, you *must* use the configuration file, define an `iconsFolder` in it, and define the `iconName` parameter for each app (including the extension). The path of the `iconsFolder` is relative to the configuration file. If you have installed ParseDashboard globally you need to use the full path as value for the `iconsFolder`. To visualize what it means, in the following example `icons` is a directory located under the same directory as the configuration file:

0 commit comments

Comments
 (0)