Instructor: For this course, any GraphQL server would do because I'm quite familiar with it, we're going to use Apollo server. Usually, Apollo server requires you to define the type definitions in the GraphQL schema language and to the servers.
For this course though, we're mostly not going to write your servers and simply mock the schema. This allows us to iterate faster when assigning the schema. We can activate the mock mode by passing in the option mocks and set it to true.
If we now run Yarn start, the server will spin off and under local host:4000, we provide us with a GraphQL ID. Let's visit the URL in a browser and run a query. As you can see, our server is running and now the query was mocked.
The Apollo server under mock mode by default will mock any type but it also gives us the opportunity to customize the mocks per type. Let's return just Hello for string instead of the Hello World. Therefore, we create a new object mocks containing one property. Its key is string and the value, a function returning Hello.
If we rerun the query, we can see that our string is now mocked with just Hello. Having paths of the schema mock, but other paths being actually resolved is also possible. We extend our type definitions with Hello to colon string and implement the resolve for it.
We pass through servers object to Apollo server and the mutations set mock and entire schema to false. Now, we can create for Hello 2 and Hello. As you can see, Hello 2 returns the resolved result while Hello still relies on the mocks. This setup should take you quite far when exploring and iterating on a new schema design.