Skip to content

Commit e677814

Browse files
committed
Update dependencies and copy in READMEs
1 parent fb898cd commit e677814

File tree

7 files changed

+6822
-3937
lines changed

7 files changed

+6822
-3937
lines changed

LICENSE.txt renamed to LICENSE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

3-
Copyright (c) [2018] [Graphcool]
3+
Copyright (c) 2018 Graphcool,
4+
Copyright (c) 2019 Formidable Labs
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1819
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1920
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2021
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
22+
SOFTWARE.

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
# React & Apollo Tutorial
1+
# React & urql Tutorial
22

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.
3+
This is the sample project that belongs to the [React & urql Tutorial](https://www.howtographql.com/react-urql/0-introduction/) on How to GraphQL.
44

55
## How to use
66

77
### 1. Clone repository
88

99
```sh
10-
git clone https://github.com/howtographql/react-apollo/
10+
git clone https://github.com/howtographql/react-urql/
1111
```
1212

1313
### 2. Install dependencies & Deploy the Prisma database API
1414

15-
To install the Prisma CLI globally with Yarn, use the following command:
15+
Install the Prisma CLI globally with Yarn or npm:
16+
1617
```sh
1718
yarn global add prisma
19+
# or with npm:
20+
npm i -g prisma
1821
```
1922

2023
Also, run the following commands:
24+
2125
```sh
22-
cd react-apollo/server
26+
# install server dependencies & deploy
27+
cd react-urql/server
2328
yarn install
2429
prisma deploy
2530
```
@@ -81,9 +86,10 @@ yarn start
8186

8287
### 4. Run the app
8388

84-
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):
89+
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-urql` (because the current tab is blocked by the process running the server):
8590

8691
```sh
92+
# install app dependencies & deploy
8793
yarn install
8894
yarn start
8995
```

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
2-
"name": "hackernews-react-apollo",
2+
"name": "hackernews-react-urql",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"apollo-boost": "0.1.4",
7-
"apollo-link-context": "1.0.7",
8-
"apollo-link-ws": "1.0.7",
9-
"graphql": "0.13.1",
10-
"react": "16.2.0",
11-
"react-apollo": "2.1.0",
12-
"react-dom": "16.2.0",
13-
"react-router": "4.2.0",
14-
"react-router-dom": "4.2.2",
15-
"react-scripts": "1.1.1",
16-
"subscriptions-transport-ws": "0.9.7"
6+
"@urql/exchange-graphcache": "^1.0.0-beta.3",
7+
"@urql/exchange-suspense": "^0.1.0",
8+
"graphql": "14.5.3",
9+
"react": "16.9.0",
10+
"react-dom": "16.9.0",
11+
"react-router": "5.0.1",
12+
"react-router-dom": "5.0.1",
13+
"react-scripts": "3.1.1",
14+
"subscriptions-transport-ws": "0.9.16",
15+
"urql": "^1.4.0"
1716
},
1817
"scripts": {
1918
"start": "react-scripts start",

server/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# React & urql Tutorial (Server)
2+
3+
This is the server as part of the sample project that belongs
4+
to the [React & urql Tutorial](https://www.howtographql.com/react-urql/0-introduction/)
5+
on How to GraphQL.
6+
7+
More instructions can be found in the root folder of this repository (`../`),
8+
but if you're here, you're likely looking to do the following:
9+
10+
### 1. Install dependencies & Deploy the Prisma database API
11+
12+
Install the Prisma CLI globally with Yarn or npm:
13+
14+
```sh
15+
yarn global add prisma
16+
# or with npm:
17+
npm i -g prisma
18+
```
19+
20+
Also, run the following commands:
21+
22+
```sh
23+
# install server dependencies & deploy
24+
cd react-urql/server
25+
yarn install
26+
prisma deploy
27+
```
28+
29+
Then, follow these steps in the interactive CLI wizard:
30+
31+
1. Select **Demo server**
32+
1. **Authenticate** with Prisma Cloud in your browser (if necessary)
33+
1. Back in your terminal, **confirm all suggested values**
34+
35+
<details>
36+
<summary>Alternative: Run Prisma locally via Docker</summary>
37+
38+
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).
39+
1. Create `docker-compose.yml` for MySQL (see [here](https://www.prisma.io/docs/prisma-server/database-connector-POSTGRES-jgfr/) for Postgres):
40+
```yml
41+
version: '3'
42+
services:
43+
prisma:
44+
image: prismagraphql/prisma:1.23
45+
restart: always
46+
ports:
47+
- "4466:4466"
48+
environment:
49+
PRISMA_CONFIG: |
50+
port: 4466
51+
databases:
52+
default:
53+
connector: mysql
54+
host: mysql
55+
port: 3306
56+
user: root
57+
password: prisma
58+
migrations: true
59+
mysql:
60+
image: mysql:5.7
61+
restart: always
62+
environment:
63+
MYSQL_ROOT_PASSWORD: prisma
64+
volumes:
65+
- mysql:/var/lib/mysql
66+
volumes:
67+
mysql:
68+
```
69+
1. Run `docker-compose up -d`
70+
1. Run `prisma deploy`
71+
72+
</details>
73+
74+
### 2. Start the server
75+
76+
To start the server, all you need to do is execute the `start` script by running the following command inside the `server` directory:
77+
78+
```sh
79+
yarn start
80+
```
81+
82+
### 3. Start the app
83+
84+
Now follow the instructions in "4. Run the app" in the [`README.md`](../README.md) in the root folder.

server/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
},
99
"dependencies": {
1010
"bcryptjs": "^2.4.3",
11-
"graphql-yoga": "^1.7.0",
12-
"jsonwebtoken": "^8.2.0",
11+
"graphql": "^14.5.3",
12+
"graphql-yoga": "^1.18.3",
13+
"jsonwebtoken": "^8.5.1",
1314
"prisma-client-lib": "^1.31.0"
1415
},
1516
"devDependencies": {

0 commit comments

Comments
 (0)