as the title
< H2 > the interface code is as follows < / H2 >/ get /avatar/file_id
router.get("/avatar", async (req, res, next) => {
    const id = req.query.file_id
    const url = await FileModel.getFilePath(id)
    res.set("content-type", "image/jpg")
    let stream = fs.createReadStream(url)
    let responseData = []; // 
    if (stream) { // 
        stream.on("data", chunk => {
            responseData.push(chunk)
        })
        stream.on("end", () => {
            let finalData = Buffer.concat(responseData)
            res.write(finalData)
            res.end();
        });
    }
})
the FileModel.getFilePath code is as follows
// 
handleFile.getFilePath = async function  (id) {
    let fileObject = await handleFile.getFileById(id)
    return path.join(__dirname, `../uploads/${fileObject.filename}`)
}
index.js introduces the history code as follows
const express = require("express")
const session = require("express-session")
const bodyParser = require("body-parser")
const routes = require("./routes")
const history = require("connect-history-api-fallback")
const path = require("path")
const favicon = require("serve-favicon")
const app = new express()
app.use(history())
app.use(bodyParser.urlencoded({extended: true}))
app.use(express.static(path.join(__dirname, "../dist")))
app.use(favicon(path.join(__dirname, "./favicon.ico")))
const sessionStore = new session.MemoryStore({ reapInterval: 3600 * 1000 })
app.use(session({
    secret: "Stefanie Sun",
    store: sessionStore,
    resave: true, //  session
    saveUninitialized: true,  // 
    cookie: { maxAge: 3600 * 1000 }, // 
    rolling: true
}))
routes(app)
but using the API to get pictures in the interface took 304 and could not get the file
 
 
 everything will be fine after I delete history 
 how to solve this 
