简体   繁体   中英

Establish a connection bgetween node js and react-native app

So I'm trying to make an app that lets me send files from my computer to an app on my phone but I don't know how to connect the react-native app and the node/express server or how I can send a relatively large file over the server. Can someone please help cause I can't seem to figure it out.

I assume you understand the minimal concepts of a RESTful API since you tagged this post with Express. React-native can use axios from where you can make requests on the client side using FormData . You can make your request similar to:

var request= new FormData();
request.append('file', csvFile);

axios.post(URL, request)
     .then(response => {})
     .catch(error => {})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM