Why does the front end request the picture in the node.js server, after getting the src path, the picture does not display properly, and the network does not display properly?

problem description

the front end requests the picture in the node.js server. After getting the src path, the img image cannot be displayed properly, and the network cannot display normally.

clipboard.png

the environmental background of the problems and what methods you have tried

vue+node.js+express for front end

related codes

/ / Please paste the code text below (do not replace the code with pictures)
var path = require ("path");

module.exports = function (app) {

app.all("*", function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With");
    res.header("Access-Control-Allow-Methods","POST,GET,PUT,DELETE,OPTIONS");
    res.header("Access-Control-Allow-Credentials", "true");
    res.header("X-Powered-By"," 3.2.1");
    res.header("Content-Type", "application/json;charset=utf-8");
    next();
});

app.use("/auth", require("./auth/index"));

app.use("/user", require("./user/index"));

app.use("/article", require("./article/index"));

app.use("/comment", require("./comment/index"));

app.use("/album", require("./album/index"));

app.use("/*", function (req,res,next) {
    return res.json({status:"success",data:""});
})

};

what result do you expect? What is the error message actually seen?

expect the results page to display the picture properly. There are no pictures on the correct page in the src path.

Jul.14,2022

Content-Type has a problem. The picture should be like image/*


your picture has returned json type. You need to convert json to blob type and display it on the page.
this article should help you:

Link description: do you know how the front end handles pictures?
https://juejin.im/post/5c6276...

Menu