• Generates an API client that can be used with both Pages Router and App Router

    Type Parameters

    • T extends Record<any, any> = never

    Parameters

    Returns V6ClientSSRRequest<T>

    Example

    import config from './amplifyconfiguration.json';
    import { listPosts } from './graphql/queries';

    const client = generateServerClientUsingReqRes({ config });

    const result = await runWithAmplifyServerContext({
    nextServerContext: { request, response },
    operation: (contextSpec) => client.graphql(contextSpec, {
    query: listPosts,
    }),
    });