1. I built a local server using express and used webpack's proxyTable to forward the online interface.
2. The online interface background is java, and the returned data is in gbk format
3. The client initiates a post request and the data can be returned correctly (in the network)
4. Console.log or rendered in Chinese on the page It’s garbled code, how to solve it
I tried iconv-lite but it didn’t work. I don’t know if it’s written incorrectly
自己写的接口
apiRoutes.post('/hospitallist.xhtml',function(req,res){
res.send(res)
})
会被转到xxx.com/hospitallist.xhtml
Finally, I solved it using the superagent method
To send data from the background to the front end, add
before instantiating the PrintWriter object