https://github.com/jpascal/graphql-upload
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various GoLang GraphQL servers
https://github.com/jpascal/graphql-upload
batch golang graphql graphql-upload middleware multipart-uploads upload-file
Last synced: 5 months ago
JSON representation
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various GoLang GraphQL servers
- Host: GitHub
- URL: https://github.com/jpascal/graphql-upload
- Owner: jpascal
- License: mit
- Created: 2018-10-15T18:03:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T15:30:41.000Z (over 3 years ago)
- Last Synced: 2024-06-19T00:39:06.938Z (almost 2 years ago)
- Topics: batch, golang, graphql, graphql-upload, middleware, multipart-uploads, upload-file
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 38
- Watchers: 4
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# graphql-upload
[](https://github.com/jpascal/graphql-upload/actions)
Middleware and an [`Upload` scalar](#class-graphqlupload) to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various golang GraphQL servers.
## Installation
```bash
go get github.com/jpascal/graphql-upload
```
## Usage
```go
server := &http.Server{
Addr: "0.0.0.0:5000",
Handler: handler.New(func(request *handler.Request) interface{} {
return graphql.Do(graphql.Params{
RequestString: request.Query,
OperationName: request.OperationName,
VariableValues: request.Variables,
Schema: schema.New(),
Context: request.Context,
})
}, &handler.Config {MaxBodySize: 1024}),
}
server.ListenAndServe()
```
## Contributing
1. Fork it ( https://github.com/jpascal/graphql-upload/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request