blob: c410f047d3afc8027ebd0b7ebf874db8d7a09f22 [file] [log] [blame]
Matteo Scandoloe19fa102017-03-09 15:38:59 -08001const httpProxy = require('http-proxy');
2
3const apiProxy = httpProxy.createProxyServer({
4 target: 'http://192.168.46.100:9101'
5});
6
7const staticFilesProxy = httpProxy.createProxyServer({
8 target: 'http://192.168.46.100/spa'
9});
10
11apiProxy.on('error', (error, req, res) => {
12 res.writeHead(500, {
13 'Content-Type': 'text/plain'
14 });
15 console.error('[Proxy]', error);
16});
17
18staticFilesProxy.on('error', (error, req, res) => {
19 res.writeHead(500, {
20 'Content-Type': 'text/plain'
21 });
22 console.error('[Proxy]', error);
23});
24
25module.exports = {
26 api: apiProxy,
27 static: staticFilesProxy
28};