Matteo Scandolo | e19fa10 | 2017-03-09 15:38:59 -0800 | [diff] [blame] | 1 | const conf = require('./gulp.conf'); |
| 2 | const proxy = require('./proxy'); |
| 3 | |
| 4 | module.exports = function () { |
| 5 | return { |
| 6 | server: { |
| 7 | baseDir: [ |
| 8 | conf.paths.tmp, |
| 9 | conf.paths.src |
| 10 | ], |
| 11 | middleware: function (req, res, next) { |
Matteo Scandolo | 0d4d1a2 | 2017-07-13 11:45:37 -0700 | [diff] [blame] | 12 | if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('xos') !== -1 || req.url.indexOf('socket') !== -1) { |
Matteo Scandolo | e19fa10 | 2017-03-09 15:38:59 -0800 | [diff] [blame] | 13 | proxy.api.web(req, res); |
| 14 | } |
Matteo Scandolo | e19fa10 | 2017-03-09 15:38:59 -0800 | [diff] [blame] | 15 | else { |
| 16 | next(); |
| 17 | } |
| 18 | } |
| 19 | }, |
| 20 | open: false |
| 21 | }; |
| 22 | }; |