[CORD-873] CRUD for Core and Service model from Chameleon
Change-Id: I45c533feba6720b82de3681d862773047e7fd6f8
diff --git a/conf/browsersync.conf.js b/conf/browsersync.conf.js
index 49936d4..e8c38fa 100644
--- a/conf/browsersync.conf.js
+++ b/conf/browsersync.conf.js
@@ -1,4 +1,18 @@
const conf = require('./gulp.conf');
+const httpProxy = require('http-proxy');
+
+// TODO move the proxy config in a separate file and share with browsersync.dist.js
+
+const proxy = httpProxy.createProxyServer({
+ target: 'http://xos.dev:9101'
+});
+
+proxy.on('error', function(error, req, res) {
+ res.writeHead(500, {
+ 'Content-Type': 'text/plain'
+ });
+ console.error('[Proxy]', error);
+});
module.exports = function () {
return {
@@ -6,8 +20,16 @@
baseDir: [
conf.paths.tmp,
conf.paths.src
- ]
+ ],
+ middleware: function(req, res, next){
+ if (req.url.indexOf('xosapi') !== -1) {
+ proxy.web(req, res);
+ }
+ else{
+ next();
+ }
+ }
},
- open: false
+ open: true
};
};