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,
}),
});
Generates an API client that can be used with both Pages Router and App Router