Commit b6656c34 by 马贞晓

完成配置

1 parent 2f02f1e7
...@@ -50,6 +50,7 @@ dotenvFiles.forEach(dotenvFile => { ...@@ -50,6 +50,7 @@ dotenvFiles.forEach(dotenvFile => {
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421 // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently. // We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd()); const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '') process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter) .split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder)) .filter(folder => folder && !path.isAbsolute(folder))
......
...@@ -85,12 +85,14 @@ module.exports = function(proxy, allowedHost) { ...@@ -85,12 +85,14 @@ module.exports = function(proxy, allowedHost) {
public: allowedHost, public: allowedHost,
proxy:{ proxy:{
"/api": { "/api": {
target: "https://www.jianshu.com/shakespeare/notes/2ce732125376/recommendations", target: "http://192.168.0.8:8080/",
pathRewrite: {"^/api" : ""} pathRewrite: {"^/api" : ""}
} }
}, },
before(app, server) { before(app, server) {
app.get('/test', function(req, res) {
res.json({ data: 'test2' });
});
// console.log(path.join(__dirname,'../src/service/mock/index.js')) // console.log(path.join(__dirname,'../src/service/mock/index.js'))
if (fs.existsSync(paths.proxySetup)) { if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons // This registers user provided middleware for proxy reasons
......
...@@ -17,7 +17,14 @@ import $http from "../../service"; ...@@ -17,7 +17,14 @@ import $http from "../../service";
componentDidMount(){ componentDidMount(){
// debugger // debugger
console.log($http) console.log($http)
$http.GET("/api") $http.GET("/test")
.then(d=>{
debugger
})
.catch(e=>{
debugger
})
$http.GET("/api/demo")
.then(d=>{ .then(d=>{
debugger debugger
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!