Skip to content

support func recruitment in server sending #183

@productdevbook

Description

@productdevbook
let apolloServer: ApolloServer<BaseContext>

function createServer() {
  const { typeDefs, resolvers: mergedResolvers } = createMergedSchema()

  if (!apolloServer) {
    apolloServer = new ApolloServer({
      typeDefs,
      resolvers: mergedResolvers,
      plugins: [
        ApolloServerPluginLandingPageLocalDefault({
          embed: true, // Enable embedded Apollo Sandbox
        }),
      ],
    })
  }

  return apolloServer
}
const handler = startServerAndCreateH3Handler(createServer, {
  context: async event => ({ event }),
})
export default defineEventHandler(handler)

unnecessary files are placed in the build before the request. I need to add a func for this. Can you ensure this. Actually, this is how the script should be written.

No overload matches this call.
  Overload 1 of 2, '(server: ApolloServer<BaseContext>, options?: H3HandlerOptions<BaseContext> | undefined): EventHandler<EventHandlerRequest, any>', gave the following error.
    Argument of type '() => ApolloServer<BaseContext>' is not assignable to parameter of type 'ApolloServer<BaseContext>'.
  Overload 2 of 2, '(server: ApolloServer<BaseContext>, options: WithRequired<H3HandlerOptions<BaseContext>, "context">): EventHandler<...>', gave the following error.
    Argument of type '() => ApolloServer<BaseContext>' is not assignable to parameter of type 'ApolloServer<BaseContext>'.ts(2769)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions