Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 1 | const conf = require('./gulp.conf'); |
Matteo Scandolo | 98b5f5d | 2017-03-17 17:09:05 -0700 | [diff] [blame] | 2 | const proxy = require('./proxy').proxy; |
| 3 | const extensionsProxy = require('./proxy').extensionsProxy; |
Matteo Scandolo | e015fa9 | 2017-05-10 09:52:36 -0700 | [diff] [blame] | 4 | const socketProxy = require('./proxy').socketProxy; |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 5 | |
| 6 | module.exports = function () { |
| 7 | return { |
| 8 | server: { |
| 9 | baseDir: [ |
| 10 | conf.paths.tmp, |
| 11 | conf.paths.src |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 12 | ], |
| 13 | middleware: function(req, res, next){ |
Matteo Scandolo | e015fa9 | 2017-05-10 09:52:36 -0700 | [diff] [blame] | 14 | if (req.url.indexOf('xosapi') !== -1) { |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 15 | proxy.web(req, res); |
| 16 | } |
Matteo Scandolo | e015fa9 | 2017-05-10 09:52:36 -0700 | [diff] [blame] | 17 | else if (req.url.indexOf('socket.io') !== -1) { |
| 18 | socketProxy.web(req, res); |
| 19 | } |
Matteo Scandolo | 47c53fc | 2017-03-23 14:11:32 -0700 | [diff] [blame] | 20 | else if (req.url.indexOf('extensions') !== -1) { |
| 21 | extensionsProxy.web(req, res); |
| 22 | } |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 23 | else{ |
| 24 | next(); |
| 25 | } |
| 26 | } |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 27 | }, |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 28 | open: true |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 29 | }; |
| 30 | }; |