- Fork repo
- Clone repo from your repositories
- run
npm install
- Run
npm start
and visithttp://localhost:4000/
- Run a query to fetch the
name
andemail
for all users - Run a query to fetch the
title
andauthor
for all posts and for each author return theirname
andid
- Add the field
posts
to theUser
type in thetypeDefs
, what type should it return? - Add a resolver for
posts
on theUser
type - Create a new type,
Comment
with fieldsid
,text
,post
andauthor
- Add some fake comment data to the database file
- Add resolvers for the necessary fields on the
Comment
type - Add a
comments
field toUser
andPost
intypeDefs
and add the required resolvers - Add a query to fetch a
Post
given anid
as a parameter - Make some queries for your new types
- Try creating some users
- Create a new mutation
createPost
with the required arguments - Create a resolver for
createPost
. Make sure to check that an author exists for the author id argument. - If you haven't used an
input
type in thetypeDefs
, refactor your code to use one. - Test your code by creating some posts. (Remember, since we are not writing to a database or file, once you refresh the server, the newly created users will have disappeared)
- Repeat steps 1 to 4 for
createComment
- Try subscribing to the
post
subscription and then creating a new post to receive an update. - Create a subscription
comment
that takes an argumentpostId
which will notify of a new comment published for a given post. Remember, you can pass any string into the PubSubasyncIterator
method, so you can pass thepostId
somewhere in there. - Try subscribing to your new
comment
subscription for one of your posts. Then create a comment for it.