'GraphQl File transfer

Is it possible to transfer a picture from the back to the front as a Upload file? How to transfer file from back to front?

What I did to transfer the image from front to back:

Adding a new data type for a file: enter image description here

Next, you will need to define scalar Upload in the sсhema.graphqls file: enter image description here

The most important thing is not to forget to write the method in Mutations in the sсhema.graphqls file: enter image description here

Look, I get javax.servlet.http.Part when I upload a photo. At the front we get the data through the Apollo hook useQuery/useMutation enter image description here

But how do I send the photo back to the front?

After all, javax.servlet.http.Part is not transferred to the front? How to write a method signature in the sсhema.graphqls file in Query section and in the implementation of this method in GraphQLMutationResolver implemented class?

I need to transfer the file. If the GraphQl team sees this message, please write more documentation on this topic.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source