[英]Migrating Apollo Server from v3 to v4 in next.js
在 v3 中你可以這樣寫“createHandler”:
export default async (req, res) => {
await startServer;
await apolloServer.createHandler({
path: "/api/graphql",
})(req, res);
};
這在 v4 中是不可能的。 錯誤是:
“ApolloServer<BaseContext>”類型上不存在屬性“createHandler”。
我閱讀了文檔,但無法理解如何做等效的
我嘗試使用這個https://github.com/apollo-server-integrations/apollo-server-integration-next但我不明白當我無法通過 npm 安裝它時我將如何導入它。我不甚至知道這是否等價,但似乎是這樣。
import { startServerAndCreateNextHandler } from '@as-integrations/next';'
別管我。 當我嘗試安裝“@as-integrations/next”時,我以某種方式輸入了“apollo-server-integration-next”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.