Bringing the resolvers together
Since we have implemented all the resolvers in separate files, it is essential to find a way to provide them to our GraphQL server. To do so, create a src/index.ts
file with the following content:
import { graphqlYogaAdapter } from '@aexol/axolotl-graphql-yoga'; import { createResolvers } from '@/src/axolotl.js'; import { UserMutation } from '@/src/UserMutation.js'; import { Query } from '@/src/Query.js'; import { Mutation } from '@/src/Mutation.js'; import { PublicMutation } from '@/src/PublicMutation'; import { Question } from '@/src/Question'; import { Answer } from '@/src/Answer'; const resolvers = createResolvers({ ...Query, ...Mutation, ...PublicMutation, ...UserMutation, ...Question, ...Answer, }); graphqlYogaAdapter({ resolvers }) .server .listen( ...