I decided to learn such a technology as GraphQL. For this, I came up with an application (I develop it on ReactNative
), a python backend (django-graphene
). How the client chose Apollo
. I set everything up, everything works, I even did a part already. And here I needed to upload a profile photo. The problem is that I haven't found a way to do this. I used to use the REST API and the client was axios
. So I just took the FormData
and passed it. Accordingly, the backend accepted and saved as usual. And here I don't even know where to start. I found the apollo-upload-client
package, but I didn't find how to integrate it into ReactNative (more precisely, there is a description there, but I didn't understand how to use it correctly). I do it like this:
const fileSubstitute = {
uri: uriFromCameraRoll,
name: "a.jpg",
type: "image/jpeg",
};
I found graphene-file-upload
for the backend, it seems to see my files, but I don't know how to save them (by the way, I can transfer the file without apollo-upload-client
).
I really like GraphQL, but uploading files is a big deal. If I don't solve it, I will be forced abandon this technology.
P.S. I didn't find any information on how to upload files via GraphQL at all. Maybe it is necessary to work with files in a different way? I will be grateful for any help