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
### 2. Create GraphQL API with [`graphcool`](https://www.npmjs.com/package/graphcool)
15
-
16
-
If you haven't already, install the Graphcool CLI:
13
+
### 2. Deploy the Prisma database service
17
14
18
15
```sh
19
-
# Install Graphcool CLI
20
-
npm install -g graphcool
16
+
cd react-apollo/server
17
+
yarn prisma deploy
18
+
```
19
+
20
+
When prompted where (i.e. to which _cluster_) you want to deploy your service, choose any of the public clusters, e.g. `public-us1` or `public-eu1`. (If you have Docker installed, you can also deploy locally.)
21
+
22
+
### 3. Set the Prisma service endpoint
23
+
24
+
From the output of the previous command, copy the `HTTP` endpoint and paste it into `server/src/index.js` where it's used to instantiate the `Prisma` binding. You need to replace the current placeholder `__PRISMA_ENDPOINT`:
Once it's installed, you can deploy the Graphcool service based on the existing definition inside the [`server`](./server) directory:
58
+
Note that the part `public-hillcloak-flier-952361` of the URL is unique to your service.
59
+
60
+
### 4. Start the server
61
+
62
+
To start the server, all you need to do is install the the dependencies execute the `start` script by running the following command inside the `server` directory:
24
63
25
64
```sh
26
-
cd server
27
65
yarn install
28
-
graphcool deploy
66
+
yarn start
29
67
```
30
68
31
-
When prompted which cluster you want to deploy to, choose any of the **Shared Clusters** options (`shared-eu-west-1`, `shared-ap-northeast-1` or `shared-us-west-2`).
69
+
> **Note**: If you want to interact with the GraphQL APIs inside a [GraphQL Playground](https://github.com/graphcool/graphql-playground), you can also run `yarn dev`.
32
70
33
-
### 3. Connect the app with your GraphQL API
71
+
### 5. Run the app
34
72
35
-
Paste the service ID (which you find in the generated `.graphcoolrc` file inside the `server` directory or by running `graphcool info`) into `./src/index.js` replacing the current placeholder `__SERVICE_ID__`.
36
-
37
-
### 4. Install dependencies & run locally
73
+
Now that the server is running, you can start the app as well. The commands need to be run in a new terminal tab/window inside the root directory `react-apollo` (because the current tab is blocked by the process running the server):
38
74
39
75
```sh
40
-
cd ..
41
76
yarn install
42
-
yarn start# open http://localhost:3000 in your browser
77
+
yarn start
43
78
```
44
79
45
-
80
+
You can now open your browser and use the app on `http://localhost:3000`.
0 commit comments