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.
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.