import { BuildContextArgs , CreateApp , InferContext } from '@graphql-ez/cloudflare' ; import { ezUnpkgAltairIDE } from '@graphql-ez/plugin-altair/unpkg' ; import { ezGraphiQLIDE } from '@graphql-ez/plugin-graphiql' ; import { ezSchema , gql } from '@graphql-ez/plugin-schema' ; import { ezVoyager } from '@graphql-ez/plugin-voyager' ; import { listen } from 'worktop/cache' ; function buildContext ( { req , cloudflare } ) { req ; cloudflare ! . req ; return { foo : 'bar' , } ; } declare module 'graphql-ez' { interface EZContext extends InferContext < typeof buildContext > { } } const { buildApp } = CreateApp ( { ez : { plugins : [ ezSchema ( { schema : { typeDefs : gql `
            type Query {
              hello: String!
            }
          ` , resolvers : { Query : { hello ( ) { return 'Hello World!' ; } , } , } , } , } ) , ezGraphiQLIDE ( ) , ezUnpkgAltairIDE ( ) , ezVoyager ( ) , ] , } , buildContext , cors : true , } ) ; const { router } = buildApp ( ) ; router . add ( 'GET' , '/' , ( _req , res ) => { res . send ( 200 , { hello : 'Hello World!' } ) ; } ) ; listen ( router . run ) ;