Upload a file with Apollo #746
-
Hi, import { GraphQLUpload } from 'graphql-upload' What next? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@TomasMoskala You can find a ton of resources online regarding file uploads to GraphQL APIs. You can probably start with the apollo documentation and the However, that being said I would advise against adding file upload to your GraphQL API in a production application for the main reason being that it adds a huge amount of load to the GraphQL server which needs to be super fast and responsive as most of your application would depend on it. |
Beta Was this translation helpful? Give feedback.
@TomasMoskala You can find a ton of resources online regarding file uploads to GraphQL APIs. You can probably start with the apollo documentation and the
graphql-upload
docs which you seem to want to use. You could also useapollo-server-express
, pass the request as part of the resolvercontext
and you can interpret the request like you would a regular express request and get the file and upload it.However, that being said I would advise against adding file upload to your GraphQL API in a production application for the main reason being that it adds a huge amount of load to the GraphQL server which needs to be super fast and responsive as most of your application would depend on it.