You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@@ -41,7 +41,15 @@ After starting the server, you can visit [http://localhost:1337/playground](http
41
41
42
42
## Using Express.js
43
43
44
-
You can also mount the GraphQL API in an Express.js application together with the REST API or solo:
44
+
You can also mount the GraphQL API in an Express.js application together with the REST API or solo. You first need to create a new project and install the required dependencies:
45
+
46
+
```bash
47
+
$ mkdir my-app
48
+
$ cd my-app
49
+
$ npm install parse-server express --save
50
+
```
51
+
52
+
Then, create an `index.js` file with the following content:
45
53
46
54
```js
47
55
constexpress=require('express');
@@ -53,7 +61,8 @@ const parseServer = new ParseServer({
53
61
databaseURI:'mongodb://localhost:27017/test',
54
62
appId:'APPLICATION_ID',
55
63
masterKey:'MASTER_KEY',
56
-
serverURL:'http://localhost:1337/parse'
64
+
serverURL:'http://localhost:1337/parse',
65
+
publicServerURL:'http://localhost:1337/parse'
57
66
});
58
67
59
68
constparseGraphQLServer=newParseGraphQLServer(
@@ -75,7 +84,14 @@ app.listen(1337, function() {
75
84
});
76
85
```
77
86
78
-
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.
87
+
And finally start your app:
88
+
89
+
```bash
90
+
$ npx mongodb-runner start
91
+
$ node index.js
92
+
```
93
+
94
+
After starting the app, you can visit [http://localhost:1337/playground](http://localhost:1337/playground) in your browser to start playing with your GraphQL API.
79
95
80
96
⚠️ 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.
0 commit comments