This server.js
I run on MacOS
Then all changes when I do on linux automatically apply on simulator on MacOS
react-native run-andriod && react-native start
node server.js && react-native run-ios
const http = require('http');
const httpProxy = require('http-proxy');
const PORT = 8081;
const target = {
host: '10.0.0.158', // change to Linux computer IP in local network
port: 8081
};
const proxy = new httpProxy.createProxyServer({target});
const proxyServer = http.createServer((req, res) => proxy.web(req, res));
// Listen to the upgrade event and proxy the
// WebSocket requests as well.
proxyServer.on('upgrade', (req, socket, head) => proxy.ws(req, socket, head));
proxyServer.listen(PORT);
console.log(`Proxy server listen ${PORT} port`);
console.log(`${target.host}:${target.port} => localhost:${PORT}`);
All functions
remote debug
,hot/live reload
WORK!