File uploads
Enabling file uploads in Apollo Client
Apollo Client doesn't support a file upload feature out of the box. If you'd like to enable file upload capabilities, you will have to set Apollo Client up manually with a 3rd party package.
Detailed instructions on how to setup Apollo Client for file upload can be found here: https://github.com/jaydenseric/apollo-upload-client.
An example configuration is show below using the apollo-upload-client package.
Bash
1npm install apollo-upload-clientBasic setup for the Apollo Client:
JavaScript
1const { ApolloClient } = require("apollo-client");
2const { InMemoryCache } = require("apollo-cache-inmemory");
3const { createUploadLink } = require("apollo-upload-client");
4
5const client = new ApolloClient({
6 cache: new InMemoryCache(),
7 link: createUploadLink(),
8});