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
Copy file name to clipboardExpand all lines: README.md
+51-44Lines changed: 51 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This is the sample project that belongs to the [React & Apollo Tutorial](https://www.howtographql.com/react-apollo/0-introduction/) on How to GraphQL.
4
4
5
-
## Running the App
5
+
## How to use
6
6
7
7
### 1. Clone repository
8
8
@@ -18,61 +18,68 @@ yarn install
18
18
yarn prisma deploy
19
19
```
20
20
21
-
When prompted where (i.e. to which _Prisma server_) you want to deploy your service, choose the **Demo server** which can be used for free in Prisma Cloud. If you haven't done so already, you will be asked to register with Prisma Cloud (which you can do via GitHub). For the following prompts in the terminal you can select the suggested values by hitting **Enter**. (If you have Docker installed, you can also choose to deploy Prisma locally by _Creating a new database_.)
22
-
23
-
### 3. Set the Prisma API endpoint
24
-
25
-
The `prisma deploy` command wrote the endpoint property into `server/database/prisma.yml`. Copy it from there 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__`:
Then, follow these steps in the interactive CLI wizard:
22
+
23
+
1. Select **Demo server**
24
+
1.**Authenticate** with Prisma Cloud in your browser (if necessary)
25
+
1. Back in your terminal, **confirm all suggested values**
26
+
27
+
<details>
28
+
<summary>Alternative: Run Prisma locally via Docker</summary>
29
+
30
+
1. Ensure you have Docker installed on your machine. If not, you can get it from [here](https://store.docker.com/search?offering=community&type=edition).
31
+
1. Create `docker-compose.yml` for MySQL (see [here](https://www.prisma.io/docs/prisma-server/database-connector-POSTGRES-jgfr/) for Postgres):
32
+
```yml
33
+
version: '3'
34
+
services:
35
+
prisma:
36
+
image: prismagraphql/prisma:1.23
37
+
restart: always
38
+
ports:
39
+
- "4466:4466"
40
+
environment:
41
+
PRISMA_CONFIG: |
42
+
port: 4466
43
+
databases:
44
+
default:
45
+
connector: mysql
46
+
host: mysql
47
+
port: 3306
48
+
user: root
49
+
password: prisma
50
+
migrations: true
51
+
mysql:
52
+
image: mysql:5.7
53
+
restart: always
54
+
environment:
55
+
MYSQL_ROOT_PASSWORD: prisma
56
+
volumes:
57
+
- mysql:/var/lib/mysql
58
+
volumes:
59
+
mysql:
60
+
```
61
+
1. Run `docker-compose up -d`
62
+
1. Run `prisma deploy`
63
+
64
+
</details>
65
+
66
+
### 3. Start the server
60
67
61
68
To start the server, all you need to do is execute the `start` script by running the following command inside the `server` directory:
62
69
63
70
```sh
64
71
yarn start
65
72
```
66
73
67
-
> **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`.
74
+
> **Note**: If you want to interact with the GraphQL API of the server inside a [GraphQL Playground](https://github.com/prisma/graphql-playground), you can navigate to [http://localhost:4000](http://localhost:4000).
68
75
69
-
### 5. Run the app
76
+
### 4. Run the app
70
77
71
-
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):
78
+
Now that the server is running, you can start the React 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):
72
79
73
80
```sh
74
81
yarn install
75
82
yarn start
76
83
```
77
84
78
-
You can now open your browser and use the app on `http://localhost:3000`.
85
+
You can now open your browser and use the app on [http://localhost:3000](http://localhost:3000).
0 commit comments