Skip to content

Commit 1765f19

Browse files
committed
update dependencies and other improvements
1 parent 628db5e commit 1765f19

File tree

9 files changed

+619
-490
lines changed

9 files changed

+619
-490
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ This is the sample project that belongs to the [React & Apollo Tutorial](https:/
88

99
```sh
1010
git clone https://github.com/howtographql/react-apollo/
11-
cd react-apollo
1211
```
1312

1413
### 2. Deploy the Prisma database service
1514

1615
```sh
17-
cd server
18-
yarn install
19-
prisma deploy
16+
cd react-apollo/server
17+
yarn prisma deploy
2018
```
2119

22-
> You can use the `prisma` CLI without having it globally installed because it's listed as a _development dependency_ in `package.json`.
23-
2420
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.)
2521

2622
### 3. Set the Prisma service endpoint
@@ -35,7 +31,7 @@ const server = new GraphQLServer({
3531
...req,
3632
db: new Prisma({
3733
typeDefs: 'src/generated/prisma.graphql',
38-
endpoint: "__PRISMA_ENDPOINT__",
34+
endpoint: '__PRISMA_ENDPOINT__',
3935
secret: 'mysecret123',
4036
}),
4137
}),
@@ -52,7 +48,7 @@ const server = new GraphQLServer({
5248
...req,
5349
db: new Prisma({
5450
typeDefs: 'src/generated/prisma.graphql',
55-
endpoint: "https://eu1.prisma.sh/public-hillcloak-flier-942261/hackernews-graphql-js/dev",
51+
endpoint: 'https://eu1.prisma.sh/public-hillcloak-flier-942261/hackernews-graphql-js/dev',
5652
secret: 'mysecret123',
5753
}),
5854
}),
@@ -63,18 +59,21 @@ Note that the part `public-hillcloak-flier-952361` of the URL is unique to your
6359

6460
### 4. Start the server
6561

66-
To start the server, all you need to do is execute the `start` script by running the following command inside the `server` directory:
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:
6763

6864
```sh
6965
yarn install
7066
yarn start
7167
```
7268

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`.
70+
7371
### 5. Run the app
7472

75-
Now that the server is running, you can run the app as well (the command needs to be run in a new terminal tab/window inside the root directory `react-apollo`):
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):
7674

7775
```sh
76+
yarn install
7877
yarn start
7978
```
8079

server/README.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

server/database/prisma.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ stage: dev
99
secret: mysecret123
1010

1111
# the file path pointing to your data model
12-
datamodel: datamodel.graphql
12+
datamodel: datamodel.graphql
13+
14+
cluster: nikolas/prisma-eu1

server/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
},
88
"dependencies": {
99
"bcryptjs": "^2.4.3",
10-
"graphql-yoga": "1.2.0",
11-
"prisma-binding": "1.4.0"
10+
"graphql-yoga": "1.3.2",
11+
"prisma-binding": "1.5.10"
1212
},
1313
"devDependencies": {
14-
"graphql-cli": "2.12.4",
14+
"graphql-cli": "2.14.1",
1515
"npm-run-all": "4.1.2",
16-
"prisma-cli": "1.0.0"
16+
"prisma": "1.2.2"
1717
}
1818
}

server/src/generated/prisma.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# THIS FILE HAS BEEN AUTO-GENERATED BY "GRAPHCOOL DEPLOY"
1+
# THIS FILE HAS BEEN AUTO-GENERATED BY "PRISMA DEPLOY"
22
# DO NOT EDIT THIS FILE DIRECTLY
33

44
#

server/src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ const server = new GraphQLServer({
1919
...req,
2020
db: new Prisma({
2121
typeDefs: 'src/generated/prisma.graphql',
22-
endpoint: "__PRISMA_ENDPOINT__",
22+
endpoint: '__PRISMA_ENDPOINT__',
2323
secret: 'mysecret123',
24+
debug: true
2425
}),
2526
}),
2627
})
2728

28-
server.start(() => console.log('Server is running on http://localhost:4000'))
29+
server.start(() => console.log('Server is running on http://localhost:4000'))

server/src/resolvers/Subscription.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const newLink = {
22
subscribe: (parent, args, ctx, info) => {
33
return ctx.db.subscription.link(
4-
{ where: { mutation_in: ['CREATED'] } },
4+
// https://github.com/graphcool/prisma/issues/1734
5+
// { where: { mutation_in: ['CREATED'] } },
6+
{ },
57
info,
68
)
79
},
@@ -10,7 +12,9 @@ const newLink = {
1012
const newVote = {
1113
subscribe: (parent, args, ctx, info) => {
1214
return ctx.db.subscription.vote(
13-
{ where: { mutation_in: ['CREATED'] } },
15+
// https://github.com/graphcool/prisma/issues/1734
16+
// { where: { mutation_in: ['CREATED'] } },
17+
{ },
1418
info,
1519
)
1620
},

server/src/schema.graphql

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@ type Query {
44
feed(filter: String, skip: Int, first: Int, orderBy: LinkOrderByInput): Feed!
55
}
66

7+
type Feed {
8+
links: [Link!]!
9+
count: Int!
10+
}
11+
712
type Mutation {
813
post(url: String!, description: String!): Link!
914
signup(email: String!, password: String!, name: String!): AuthPayload
1015
login(email: String!, password: String!): AuthPayload
1116
vote(linkId: ID!): Vote
1217
}
1318

14-
type Subscription {
15-
newLink: LinkSubscriptionPayload
16-
newVote: VoteSubscriptionPayload
17-
}
18-
19-
type Feed {
20-
links: [Link!]!
21-
count: Int!
22-
}
23-
24-
2519
type AuthPayload {
2620
token: String
2721
user: User
@@ -32,3 +26,8 @@ type User {
3226
name: String!
3327
email: String!
3428
}
29+
30+
type Subscription {
31+
newLink: LinkSubscriptionPayload
32+
newVote: VoteSubscriptionPayload
33+
}

0 commit comments

Comments
 (0)