graphile / crystal

🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!
https://graphile.org/
Other
12.58k stars 569 forks source link

File Upload Support #972

Open chadfurman opened 5 years ago

chadfurman commented 5 years ago

I'm submitting a ...

PostGraphile version:

4.0.1


https://blog.apollographql.com/file-uploads-with-apollo-server-2-0-5db2f3f60675

There is a way to do file uploads in GraphQL and I don't see it in your docs or your github issues list

benjie commented 5 years ago

@mattbretl has written a file uploads example here:

https://github.com/mattbretl/postgraphile-upload-example/blob/master/README.md

Where do you want to upload the file to? Are you intending to store it as BYTEA in the database?

In my own projects I upload files directly to Amazon S3 (using a signed URL generated by the GraphQL API) and then send the resulting URL to the GraphQL server when upload completes.

mattbretl commented 5 years ago

Fair warning, that was one of the first plugins that I cobbled together.. I'd like to rewrite it using makeWrapResolversPlugin at some point.

chadfurman commented 5 years ago

My personal plan was S3 storage also, so a plugin that takes in an ARN and posts the images there could be cool.

I will reference this example when I need this feature. Thank you, @mattbretl !