blob: 02f9d5e5deb2b0267e37e9ad34a24502c56af390 [file] [log] [blame]
Max Chu3c8b65f2017-07-19 17:47:59 -07001const httpProxy = require('http-proxy');
2
3const target = process.env.PROXY || '192.168.46.100';
4
5const apiProxy = httpProxy.createProxyServer({
6 target: `http://${target}`
7});
8
9apiProxy.on('error', (error, req, res) => {
10 res.writeHead(500, {
11 'Content-Type': 'text/plain'
12 });
13 console.error('[Proxy]', error);
14});
15
16module.exports = {
17 api: apiProxy
18};