Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hribb/apollo-upload-network-interface
UploadNetworkInterface for Apollo GraphQL Client
https://github.com/hribb/apollo-upload-network-interface
graphql
Last synced: 7 days ago
JSON representation
UploadNetworkInterface for Apollo GraphQL Client
- Host: GitHub
- URL: https://github.com/hribb/apollo-upload-network-interface
- Owner: HriBB
- License: mit
- Created: 2016-11-14T23:34:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-11T08:05:20.000Z (almost 8 years ago)
- Last Synced: 2025-01-08T06:40:08.148Z (about 1 month ago)
- Topics: graphql
- Language: JavaScript
- Size: 7.81 KB
- Stars: 37
- Watchers: 5
- Forks: 12
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# apollo-upload-network-interface
UploadNetworkInterface for Apollo GraphQL Client. Adds support for `multipart/form-data` requests.
Used together with [graphql-server-express-upload](https://github.com/HriBB/graphql-server-express-upload) and [graphql-server-koa-upload](https://github.com/HriBB/graphql-server-koa-upload) (coming soon).
_Any help is appreciated!_
## Usage
```
import ApolloClient from 'apollo-client'
import createNetworkInterface from 'apollo-upload-network-interface'const networkInterface = createNetworkInterface({
uri: '/graphql',
})const client = new ApolloClient({
networkInterface
})
```
If you get an error like this
```
/node_modules/apollo-client/transport/networkInterface.js:9
import 'whatwg-fetch';
^^^^^^SyntaxError: Unexpected token import
```
You need to configure you `babel-loader` like this
```
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!(apollo-client)\/).*/,
include: [
path.resolve(__dirname, '..', 'config'),
path.resolve(__dirname, '..', 'client'),
path.resolve(__dirname, '..', 'node_modules', 'apollo-client'),
//reactMdlExtraPath,
],
query: {
cacheDirectory: true,
},
}
```## TODO
- [ ] Add tests
- [ ] Convert to typescript