blob: 940250507613a49a459dfdad17e2b5d2ba8ff378 [file] [log] [blame]
Matteo Scandolof0446ed2017-08-08 13:05:24 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
Matteo Scandolof0446ed2017-08-08 13:05:24 -07004 * 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 Scandolof0446ed2017-08-08 13:05:24 -07007 * http://www.apache.org/licenses/LICENSE-2.0
Matteo Scandolof0446ed2017-08-08 13:05:24 -07008 * 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 Scandoloc46a82d2017-03-24 18:37:18 -070016const conf = require('./gulp.conf');
17const proxy = require('./proxy');
18
19module.exports = function () {
20 return {
21 server: {
22 baseDir: [
23 conf.paths.tmp,
24 conf.paths.src
25 ],
26 middleware: function (req, res, next) {
Matteo Scandolo22f8e822017-09-28 16:35:20 -070027 if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('xos') !== -1 || req.url.indexOf('socket') !== -1) {
28 proxy.web(req, res);
Matteo Scandoloc46a82d2017-03-24 18:37:18 -070029 }
30 else {
31 next();
32 }
33 }
34 },
35 open: false
36 };
Matteo Scandolo22f8e822017-09-28 16:35:20 -070037};