我正在像这样的本机反应中进行API调用:
let response = await fetch('localhost:5000/api/klant/1');
我想做
let response = await fetch('/api/klant/1');
使用react native可以在package.json上设置一个代理conf。我想知道是否可以使用独立的博览会应用程序。
package.json的示例
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"expo": "^32.0.0",
"expokit": "^32.0.7",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-redux": "^6.0.1",
"redux": "^4.0.1"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
},
"proxy": "localhost:5000",
"private": true
}
谢谢!