Current code has a problem that calling proxyReq.end() method don't wait proxyReq.write(req.body).
To fix, proxyReq.end() must be called in callback that be passed second argument with proxyReq.write().
Another solution is piping the original request to proxy with req.pipe(). By use it, dont need to use JSON.stringify() to serialize request body.
So, performance improvement expected.
Current code has a problem that calling proxyReq.end() method don't wait proxyReq.write(req.body). To fix, proxyReq.end() must be called in callback that be passed second argument with proxyReq.write().
Another solution is piping the original request to proxy with req.pipe(). By use it, dont need to use JSON.stringify() to serialize request body. So, performance improvement expected.
And more type-safe.