Skip to content

Commit 09f1093

Browse files
committed
fix: linting
1 parent b5102b3 commit 09f1093

21 files changed

+3655
-4491
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ I will walk you through each file later on and teach you what it's for.
6060

6161
One awesome tool that comes with [graphql-yoga](https://github.com/prisma/graphql-yoga) is [GraphQL Playground](https://github.com/prisma/graphql-playground). GraphQL Playground allows us to test our schemas without having to set up a client side. Essentially, it serves as a GraphQL client to run [queries](#Queries) and [mutations](#Mutations) on.
6262

63-
After cloning the repository, run `yarn start` and navigate to http://localhost:4000. Don't worry. At this point it is normal to have zero clue about what the playground is all about. Pasted below is the process of setting up a simple GraphQLServer and serving it on port 4000. Disregard the imports as they will be discussed later on. All you have to know is that the following section of code sets you up with a working GraphQLServer.
63+
After cloning the repository, run `yarn start` and navigate to http://localhost:5000. Don't worry. At this point it is normal to have zero clue about what the playground is all about. Pasted below is the process of setting up a simple GraphQLServer and serving it on port 5000. Disregard the imports as they will be discussed later on. All you have to know is that the following section of code sets you up with a working GraphQLServer.
6464

6565
```javascript
6666
// backend/src/index.js
@@ -94,9 +94,9 @@ const server = new GraphQLServer({
9494
}
9595
})
9696

97-
// Serving server on port 4000
98-
server.start({ port: process.env.PORT | 4000 }, () => {
99-
console.log(`The server is up on port ${process.env.PORT | 4000}!`)
97+
// Serving server on port 5000
98+
server.start({ port: process.env.PORT | 5000 }, () => {
99+
console.log(`The server is up on port ${process.env.PORT | 5000}!`)
100100
})
101101
```
102102

@@ -511,12 +511,12 @@ import { getMainDefinition } from 'apollo-utilities'
511511

512512
// Create an http link:
513513
const httpLink = new HttpLink({
514-
uri: 'http://localhost:4000/'
514+
uri: 'http://localhost:5000/'
515515
})
516516

517517
// Create a WebSocket link:
518518
const wsLink = new WebSocketLink({
519-
uri: `ws://localhost:4000/`,
519+
uri: `ws://localhost:5000/`,
520520
options: { reconnect: true }
521521
})
522522

backend/src/db.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,75 @@ const users = [
33
id: '1',
44
name: 'Andrew',
55
6-
age: 27
6+
age: 27,
77
},
88
{
99
id: '2',
1010
name: 'Sarah',
11-
11+
1212
},
1313
{
1414
id: '3',
1515
name: 'Mike',
16-
17-
}
18-
]
16+
17+
},
18+
];
1919

2020
const posts = [
2121
{
2222
id: '10',
2323
title: 'GraphQL 101',
2424
body: 'This is how to use GraphQL...',
2525
published: true,
26-
author: '1'
26+
author: '1',
2727
},
2828
{
2929
id: '11',
3030
title: 'GraphQL 201',
3131
body: 'This is an advanced GraphQL post...',
3232
published: false,
33-
author: '1'
33+
author: '1',
3434
},
3535
{
3636
id: '12',
3737
title: 'Programming Music',
3838
body: '',
3939
published: true,
40-
author: '2'
41-
}
42-
]
40+
author: '2',
41+
},
42+
];
4343

4444
const comments = [
4545
{
4646
id: '102',
4747
text: 'This worked well for me. Thanks!',
4848
author: '3',
49-
post: '10'
49+
post: '10',
5050
},
5151
{
5252
id: '103',
5353
text: 'Glad you enjoyed it.',
5454
author: '1',
55-
post: '10'
55+
post: '10',
5656
},
5757
{
5858
id: '104',
5959
text: 'This did no work.',
6060
author: '2',
61-
post: '11'
61+
post: '11',
6262
},
6363
{
6464
id: '105',
6565
text: 'Nevermind. I got it to work.',
6666
author: '1',
67-
post: '12'
68-
}
69-
]
67+
post: '12',
68+
},
69+
];
7070

7171
const db = {
7272
users,
7373
posts,
74-
comments
75-
}
74+
comments,
75+
};
7676

77-
export { db as default }
77+
export { db as default };

backend/src/index.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { GraphQLServer, PubSub } from 'graphql-yoga'
2-
import db from './db'
3-
import Query from './resolvers/Query'
4-
import Mutation from './resolvers/Mutation'
5-
import Subscription from './resolvers/Subscription'
6-
import User from './resolvers/User'
7-
import Post from './resolvers/Post'
8-
import Comment from './resolvers/Comment'
1+
import { GraphQLServer, PubSub } from 'graphql-yoga';
2+
import db from './db';
3+
import Query from './resolvers/Query';
4+
import Mutation from './resolvers/Mutation';
5+
import Subscription from './resolvers/Subscription';
6+
import User from './resolvers/User';
7+
import Post from './resolvers/Post';
8+
import Comment from './resolvers/Comment';
99

10-
const pubsub = new PubSub()
10+
const pubsub = new PubSub();
1111

1212
const server = new GraphQLServer({
1313
typeDefs: './src/schema.graphql',
@@ -17,14 +17,14 @@ const server = new GraphQLServer({
1717
Subscription,
1818
User,
1919
Post,
20-
Comment
20+
Comment,
2121
},
2222
context: {
2323
db,
24-
pubsub
25-
}
26-
})
24+
pubsub,
25+
},
26+
});
2727

28-
server.start({ port: process.env.PORT | 4000 }, () => {
29-
console.log(`The server is up on port ${process.env.PORT | 4000}!`)
30-
})
28+
server.start({ port: process.env.PORT | 5000 }, () => {
29+
console.log(`The server is up on port ${process.env.PORT | 5000}!`);
30+
});

backend/src/resolvers/Comment.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const Comment = {
22
author(parent, args, { db }, info) {
3-
return db.users.find(user => {
4-
return user.id === parent.author
5-
})
3+
return db.users.find((user) => {
4+
return user.id === parent.author;
5+
});
66
},
77
post(parent, args, { db }, info) {
8-
return db.posts.find(post => {
9-
return post.id === parent.post
10-
})
11-
}
12-
}
8+
return db.posts.find((post) => {
9+
return post.id === parent.post;
10+
});
11+
},
12+
};
1313

14-
export { Comment as default }
14+
export { Comment as default };

0 commit comments

Comments
 (0)