Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 1 | const conf = require('./gulp.conf'); |
Matteo Scandolo | f4d8013 | 2017-03-20 11:49:17 -0700 | [diff] [blame] | 2 | const proxy = require('./proxy').proxy; |
| 3 | const extensionsProxy = require('./proxy').extensionsProxy; |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 4 | |
| 5 | module.exports = function () { |
| 6 | return { |
| 7 | server: { |
| 8 | baseDir: [ |
| 9 | conf.paths.dist |
Matteo Scandolo | 4e87023 | 2017-01-30 13:43:05 -0800 | [diff] [blame] | 10 | ], |
Matteo Scandolo | c80ccbd | 2017-02-27 16:24:33 -0800 | [diff] [blame] | 11 | middleware: function(req, res, next){ |
| 12 | if (req.url.indexOf('xosapi') !== -1) { |
| 13 | proxy.web(req, res); |
| 14 | } |
Matteo Scandolo | f4d8013 | 2017-03-20 11:49:17 -0700 | [diff] [blame] | 15 | else if (req.url.indexOf('extensions') !== -1) { |
| 16 | extensionsProxy.web(req, res); |
| 17 | } |
Matteo Scandolo | c80ccbd | 2017-02-27 16:24:33 -0800 | [diff] [blame] | 18 | else{ |
| 19 | next(); |
| 20 | } |
| 21 | }, |
Matteo Scandolo | 4e87023 | 2017-01-30 13:43:05 -0800 | [diff] [blame] | 22 | routes: { |
Matteo Scandolo | f818312 | 2017-04-24 15:03:00 -0700 | [diff] [blame] | 23 | "/xos": "./dist" |
Matteo Scandolo | 4e87023 | 2017-01-30 13:43:05 -0800 | [diff] [blame] | 24 | } |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 25 | }, |
Matteo Scandolo | c80ccbd | 2017-02-27 16:24:33 -0800 | [diff] [blame] | 26 | open: true |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 27 | }; |
| 28 | }; |