(options, body)
| 22 | app.use(compress()); |
| 23 | |
| 24 | function request(options, body) { |
| 25 | return new Promise((resolve, reject) => { |
| 26 | const req = http.request(options, res => { |
| 27 | resolve(res); |
| 28 | }); |
| 29 | req.on('error', e => { |
| 30 | reject(e); |
| 31 | }); |
| 32 | body.pipe(req); |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | app.all('/', async function (req, res, next) { |
| 37 | // Proxy the request to the regional server. |