Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

File Handling like Active Storage in Rails #43

Open
guledali opened this issue Jan 27, 2019 · 7 comments
Open

File Handling like Active Storage in Rails #43

guledali opened this issue Jan 27, 2019 · 7 comments

Comments

@guledali
Copy link

guledali commented Jan 27, 2019

Describe

Integrate an easy solution for uploading files that is build into this framework!

@wtrocki
Copy link
Contributor

wtrocki commented Jan 27, 2019

It should be simple thing to do using ejected template and apollo file uploads: https://blog.apollographql.com/file-uploads-with-apollo-server-2-0-5db2f3f60675

However it will be nice to check it nexus will handle this using FileUpload scalar etc. and have separate template for this case.
@guledali This sounds like good community contribution that could be done as template.
See also: #31

@guledali guledali mentioned this issue Mar 5, 2019
9 tasks
@Weakky
Copy link
Contributor

Weakky commented Mar 5, 2019

I'm not sure whether we need any kind of integration to support upload here.

https://github.com/jaydenseric/graphql-upload seems to do the job on its own, and should not require you to eject at any time.

All you should need is to export the Upload type from one of your resolvers file, and then the library gives you other utils to handle it.

Wouldn't that be enough?

@guledali
Copy link
Author

guledali commented Mar 5, 2019

@Weakky It would be nice if this was build into the framework somehow like out of the box solution.

@guledali
Copy link
Author

guledali commented Mar 6, 2019

@Weakky I know you're working on the docs right now could you at least add section on how to do
File Upload

@rohit-ravikoti
Copy link

I was able to get it working by doing the following:

  1. Add a new file src/graphql/Upload.ts
  2. paste the following code in the file:
import { scalarType } from "yoga";
import { GraphQLUpload } from 'graphql-upload'

export const Upload = scalarType(GraphQLUpload)

@Weakky
Copy link
Contributor

Weakky commented Mar 15, 2019

@rohit-ravikoti You don't event need to use scalarType here, nexus supports graphql-js types out of the box.

import { GraphQLUpload } from 'graphql-upload'

export const Upload = GraphQLUpload

Should be sufficient

@guledali I'll add a section for that!

@schickling
Copy link
Contributor

More context: https://spectrum.chat/nexus/general/uploading-files-with-nexus-yoga2~e9643500-d4b7-4548-b4fb-f8eac6221916

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants