• gulp 跨域


    //引入插件
    var gulp = require('gulp');
    // var Proxy = require('gulp-connect-proxy');
    var connect = require('gulp-connect');
    var proxy = require('http-proxy-middleware');
    
    
    
    //使用connect启动一个Web服务器
    gulp.task('connect', function () {
        connect.server({
            root: './',
            livereload: true,
            port: 8010,
            middleware: function (connect, opt) {
                return [
                    proxy(
                      '/api',{
                      // target: 'http://localhost:8890',
                      target: 'http://wx-test.yegemai.com/',
                      changeOrigin:true,
                      pathRewrite: {
                          '^/api': ''
                      }
                    }),
                    proxy('/fs', {
                        target: 'http://admin.mifengjiafu.com/',
                        changeOrigin:true,
                        pathRewrite: {
                            '^/fs': ''
                        }
                    }),
                    proxy('/product', {
                        target: 'http://172.16.1.60:8080',
                        changeOrigin:true
                    }),
                    proxy('/bpauth', {
                        target: 'http://192.168.24.77:8080',
                        changeOrigin:true
                    })
                ]
            }
        });
    });
    
    gulp.task('watch', function () {
        gulp.watch(['./*.html'], ['html']);
    
    });
    
    gulp.task('html', function () {
        gulp.src('./*.html')
            .pipe(connect.reload());
    });
    
    
    //运行Gulp时,默认的Task
    gulp.task('default', ['connect', 'watch']);
  • 相关阅读:
    PL/SQL异常处理
    spool命令
    Oracle循环语句
    替换变量&和&&
    OCP-052 & 053部分答案解析
    Oracle IF & CASE语句
    PL/SQL概念
    AIX下如何根据端口号查找相应的进程
    (转)Tomcat启动报Error listenerStart错误
    Suse碎碎念
  • 原文地址:https://www.cnblogs.com/ron123/p/9509064.html
Copyright © 2020-2023  润新知