Explorar o código

config proxyTable

lin-xin %!s(int64=8) %!d(string=hai) anos
pai
achega
8c2ddc63f5
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      config/index.js

+ 9 - 1
config/index.js

@@ -27,7 +27,15 @@ module.exports = {
         autoOpenBrowser: true,
         assetsSubDirectory: 'static',
         assetsPublicPath: '/',
-        proxyTable: {},
+        proxyTable: {
+            '/api':{
+                target:'http://jsonplaceholder.typicode.com',
+                changeOrigin:true,
+                pathRewrite:{
+                    '/api':''
+                }
+            }
+        },
         // CSS Sourcemaps off by default because relative paths are "buggy"
         // with this option, according to the CSS-Loader README
         // (https://github.com/webpack/css-loader#sourcemaps)