Reputation: 1
I am learning graphql .I followed this article 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%20instead. for file upload using graphql apollo-server but get endless buffering for response and empty file in images folder.
I am certain error is in following two files
Upvotes: 0
Views: 1706
Reputation: 81
You need to add graphql-upload
package using yarn add graphql-upload
. Then you need to do some changes inside ApolloServer creation into the main server file,
const apolloServer = new ApolloServer({
schema,
resolvers,
uploads: false, // add this
});
then you need to add graphqlUploadExpress
middleware from graphql-upload
inside your main server file,
app.use(graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }));
For more refer to this github issue https://github.com/MichalLytek/type-graphql/issues/37#issuecomment-592467594
Upvotes: 3