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 in your browser to start playing with your GraphQL API.
@@ -446,9 +446,17 @@ After starting the server, you can visit http://localhost:1337/playground in you
446
446
447
447
### Using Express.js
448
448
449
-
You can also mount the GraphQL API in an Express.js application together with the REST API or solo:
449
+
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:
450
450
451
+
```bash
452
+
$ mkdir my-app
453
+
$ cd my-app
454
+
$ npm install parse-server express --save
451
455
```
456
+
457
+
Then, create an `index.js` file with the following content:
After starting the server, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
492
+
And finally start your app:
493
+
494
+
```bash
495
+
$ npx mongodb-runner start
496
+
$ node index.js
497
+
```
498
+
499
+
After starting the app, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
484
500
485
501
***Note:*** Do ***NOT*** mount the GraphQL Playground in production. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
486
502
@@ -504,43 +520,93 @@ You should receive the following response:
504
520
}
505
521
```
506
522
507
-
## Creating your first object
523
+
## Creating your first class
508
524
509
-
Since your application does not have a schema yet, you can use the generic `create` mutation to create your first object. Run the following:
525
+
Since your application does not have any schema yet, you can use the `createClass` mutation to create your first class. Run the following:
Parse Server learned from the first object that you created and now you have the `GameScore` class in your schema. You can now start using the automatically generated operations!
590
+
Parse Server learned from the first class that you created and now you have the `GameScore` class in your schema. You can now start using the automatically generated operations!
@@ -551,8 +617,13 @@ You should receive a response similar to this:
551
617
{
552
618
"data": {
553
619
"createGameScore": {
554
-
"objectId": "XyvErLoJ2O",
555
-
"createdAt": "2019-08-27T06:37:32.078Z"
620
+
"id": "XN75D94OBD",
621
+
"updatedAt": "2019-09-17T06:50:26.357Z",
622
+
"createdAt": "2019-09-17T06:50:26.357Z",
623
+
"playerName": "Sean Plott",
624
+
"score": 1337,
625
+
"cheatMode": false,
626
+
"ACL": null
556
627
}
557
628
}
558
629
}
@@ -564,8 +635,13 @@ You can also run a query to this new class:
564
635
queryGameScores {
565
636
gameScores {
566
637
results {
638
+
id
639
+
updatedAt
640
+
createdAt
567
641
playerName
568
642
score
643
+
cheatMode
644
+
ACL
569
645
}
570
646
}
571
647
}
@@ -579,12 +655,13 @@ You should receive a response similar to this:
579
655
"gameScores": {
580
656
"results": [
581
657
{
658
+
"id": "XN75D94OBD",
659
+
"updatedAt": "2019-09-17T06:50:26.357Z",
660
+
"createdAt": "2019-09-17T06:50:26.357Z",
582
661
"playerName": "Sean Plott",
583
-
"score": 1337
584
-
},
585
-
{
586
-
"playerName": "Luke Skywalker",
587
-
"score": 2558
662
+
"score": 1337,
663
+
"cheatMode": false,
664
+
"ACL": null
588
665
}
589
666
]
590
667
}
@@ -599,7 +676,7 @@ Parse GraphQL Server allows you to create a custom GraphQL schema with own queri
599
676
To start creating your custom schema, you need to code a `schema.graphql` file and initialize Parse Server with `--graphQLSchema` and `--cloud` options:
0 commit comments