blob: 391f68881a1fa0fbf6a1357df72d54d80a0895b3 [file] [log] [blame]
Matteo Scandolod819c922016-12-02 14:06:14 -08001const conf = require('./gulp.conf');
Matteo Scandolo98b5f5d2017-03-17 17:09:05 -07002const proxy = require('./proxy').proxy;
3const extensionsProxy = require('./proxy').extensionsProxy;
Matteo Scandolod819c922016-12-02 14:06:14 -08004
5module.exports = function () {
6 return {
7 server: {
8 baseDir: [
9 conf.paths.tmp,
10 conf.paths.src
Matteo Scandolo1aee1982017-02-17 08:33:23 -080011 ],
12 middleware: function(req, res, next){
Matteo Scandolo47c53fc2017-03-23 14:11:32 -070013 if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('socket.io') !== -1) {
Matteo Scandolo1aee1982017-02-17 08:33:23 -080014 proxy.web(req, res);
15 }
Matteo Scandolo47c53fc2017-03-23 14:11:32 -070016 else if (req.url.indexOf('extensions') !== -1) {
17 extensionsProxy.web(req, res);
18 }
Matteo Scandolo1aee1982017-02-17 08:33:23 -080019 else{
20 next();
21 }
22 }
Matteo Scandolod819c922016-12-02 14:06:14 -080023 },
Matteo Scandolo1aee1982017-02-17 08:33:23 -080024 open: true
Matteo Scandolod819c922016-12-02 14:06:14 -080025 };
26};