[英]Missing multipart field ‘operations’ with graphql-upload and apollo-server
[英]File upload error in graphql apollo-server
我正在学习 graphql 。我跟着这篇文章https://dev.to/dnature/handling-file-uploads-with-apollo-server-2-0-14n7#:~:text=With%20Apollo%20Server%202.0% 2C%20you,a%20cloud%20storage%20provider%20 代替。 用于使用 graphql apollo-server 上传文件,但在图像文件夹中为响应和空文件获得无限缓冲。
我确定以下两个文件中存在错误
您需要使用yarn add graphql-upload
添加graphql-upload
包。 然后你需要在 ApolloServer 创建里面做一些修改到主服务器文件中,
const apolloServer = new ApolloServer({
schema,
resolvers,
uploads: false, // add this
});
然后你需要在你的主服务器文件中从graphql-upload
添加graphqlUploadExpress
中间件,
app.use(graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }));
有关更多信息,请参阅此 github 问题https://github.com/MichalLytek/type-graphql/issues/37#issuecomment-592467594
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.