API Setup
#
Initialize Finch ApiThe FinchApi class is a class that allows you to create an executable graphql schema. It is modeled to look just like the ApolloServer class. The only required properties in the options are typeDefs and resolvers.
#
TypeDefsTypeDefs are schemas for the GraphQL api. These can be a GraphQL document or and array of GraphQL documents. These help you define what the graph contracts of your GraphQL api.
The typeDefs exported in the example above can be passed to FinchAPI as the key typeDefs and we now have a schema.
You can learn more about what can go into a schema in the official GraphQL docs.
#
ResolversResolvers are functions that can be executed in the graph that will allow your to asynchronously query or mutate data. This is the same shape as you would have setting up resolvers in ApolloServer.
The exported resolvers variable can now be passed to FinchApi to be able to setup the functions that get ran when a resolver is queried on the graph.
Read more about resolvers in the official GraphQL docs.
This will allow you to have your custom messages working properly and be able to use Finch GraphQL as well.