浏览代码

Proxy requests to /api to backend server

sbkwgh 8 年之前
父节点
当前提交
7c522c1fb3
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      config/index.js

+ 6 - 1
config/index.js

@@ -21,7 +21,12 @@ module.exports = {
     port: 8080,
     assetsSubDirectory: 'static',
     assetsPublicPath: '/',
-    proxyTable: {},
+    proxyTable: {
+        '/api': {
+            target: 'http://localhost:3000',
+            changeOrigin: true
+        }
+    },
     // 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)