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) { |
| 12 | if (req.url.indexOf('xosapi') !== -1) { |
| 13 | proxy.api.web(req, res); |
| 14 | } |
| 15 | else if (req.url.indexOf('spa') !== -1 || req.url.indexOf('socket') !== -1) { |
| 16 | proxy.static.web(req, res); |
| 17 | } |
| 18 | else { |
| 19 | next(); |
| 20 | } |
| 21 | } |
| 22 | }, |
| 23 | open: false |
| 24 | }; |
| 25 | }; |