Matteo Scandolo | f0446ed | 2017-08-08 13:05:24 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
Matteo Scandolo | f0446ed | 2017-08-08 13:05:24 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Matteo Scandolo | f0446ed | 2017-08-08 13:05:24 -0700 | [diff] [blame] | 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
Matteo Scandolo | f0446ed | 2017-08-08 13:05:24 -0700 | [diff] [blame] | 8 | * Unless required by applicable law or agreed to in writing, software |
| 9 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | * See the License for the specific language governing permissions and |
| 12 | * limitations under the License. |
| 13 | */ |
| 14 | |
| 15 | |
Matteo Scandolo | c46a82d | 2017-03-24 18:37:18 -0700 | [diff] [blame] | 16 | const conf = require('./gulp.conf'); |
| 17 | const proxy = require('./proxy'); |
| 18 | |
| 19 | module.exports = function () { |
| 20 | return { |
| 21 | server: { |
| 22 | baseDir: [ |
| 23 | conf.paths.tmp, |
| 24 | conf.paths.src |
| 25 | ], |
| 26 | middleware: function (req, res, next) { |
Matteo Scandolo | 22f8e82 | 2017-09-28 16:35:20 -0700 | [diff] [blame^] | 27 | if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('xos') !== -1 || req.url.indexOf('socket') !== -1) { |
| 28 | proxy.web(req, res); |
Matteo Scandolo | c46a82d | 2017-03-24 18:37:18 -0700 | [diff] [blame] | 29 | } |
| 30 | else { |
| 31 | next(); |
| 32 | } |
| 33 | } |
| 34 | }, |
| 35 | open: false |
| 36 | }; |
Matteo Scandolo | 22f8e82 | 2017-09-28 16:35:20 -0700 | [diff] [blame^] | 37 | }; |