Giter Club home page Giter Club logo

Comments (6)

mtboom avatar mtboom commented on May 21, 2024

我注释掉了mock但是还是发不出proxy的请求,请问我应该再改哪些地方才能在本地使用proxy

from antd-admin.

zuiidea avatar zuiidea commented on May 21, 2024

@encorehe,没有其他地方了,不过你可以在utils/config.js里添加一个字段,引入就可以了

from antd-admin.

zuiidea avatar zuiidea commented on May 21, 2024

@mtboom,如果要使用可以本地proxy,

  • 使用npm run start命令
  • 访问localhost:8989
  • 注释掉 src/utils/index.js 里的 mock

from antd-admin.

mtboom avatar mtboom commented on May 21, 2024

@zuiidea 问题已经解决
使用npm run start命令
访问localhost:8989
注释掉 src/utils/index.js 里的 mock
使用 fetch 发送请求

from antd-admin.

wuyongdec avatar wuyongdec commented on May 21, 2024

@mtboom
本地proxy怎么配置呢?
是不是类似这样:
"proxy": { "/api": { "target": "http://jsonplaceholder.typicode.com/", "changeOrigin": true, "pathRewrite": { "^/api" : "" } } }

from antd-admin.

102010cncger avatar 102010cncger commented on May 21, 2024

我用springboot的zuul做的代理

配置如下,坑了我好久的是必须配置/base/而不是/base,希望能给大家帮助

package.json中

"scripts": {
"start": "dora --plugins "proxy,webpack?publicPath=/base/,webpack-hmr,browser-history?index=/src/index.html"",
"dev": "dora --plugins "webpack?publicPath=/base/,webpack-hmr,browser-history?index=/src/index.html"",
"lint": "eslint --fix --ext .js,.jsx src/components/layout",
"build": "atool-build"
},

zuul配置如下

#eit反向代理到8000端口,多个用,分隔
zuul.routes.base.path=/base/**
zuul.routes.base.url=http://127.0.0.1:8000
zuul.routes.base.stripPrefix=false
#eit.ribbon.listOfServers=127.0.0.1:8080

from antd-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.