Ng2 has a problem with setting up a proxy service on its own. ~

follow the course, still request mock data of less than 8000 port
"data of port 8000 can be requested directly to
, but request 8000 port

at port 4001.

clipboard.png
clipboard.png
clipboard.png

clipboard.png,

help me with some suggestions

Mar.01,2021

"/api":{
    "target":"",
    "secure": false,
    "changeOrigin": true
}

the document is here: https://doc.webpack-china.org.

is the request to 8000, but there is no request for the interface?
http.get ('/ api/products') will request localhost:8000/api/products . If you want to request localhost:8000/products , you should add pathRewrite .


1proxy.conf.js<br>2

{
    "/api":{
        "target":"http://localhost:8000",
        "secure": false,
        "changeOrigin": true
    }
}

3. In the package.json file
"start": "ng serve-- proxy-config proxy.conf.json",

4, npm run start remember that it must be run start, not ng serve,. I cried foolishly by myself

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be9ada-545f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be9ada-545f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?