webpack-dev-server配置

webpack.config.js中修改 

 devServer: {
    historyApiFallback: true,
    noInfo: true,
    inline: true,
    stats: { colors: true },
    proxy: {
        '/api': {
          target: 'http://192.168.1.130:8080/',
          pathRewrite: {'^/api' : ''},
          changeOrigin: true,
          secure: false,
        }
      }
  },

 

 

js调用:

.Ajax("/login",{ },
    function(data){
               consol.log(data) 
            })

 

posted on 2017-04-20 16:32  凛冬  阅读(215)  评论(0编辑  收藏  举报