'How to change pug after first sending it in NodeJS

Somehow, I can't seem to change anything after first sending my pug file. I have an array of image URLs and am sending it to pug and receiving it in pug like this:

function putnewvalsinpug() {
db.get('URL', function (err, value) {
    if (err) return console.log('', err);
    var newnewval = ""
    data = value;
    data = data.toString()
    var stringArray = data.split(" ");
    console.log(stringArray);
    app.get('/', (req, res) => {
        res.render('index', {imgsrcs: stringArray});
    });
})
}
    each image in imgsrcs
      a(href=image)
        img(src=image) 

when I add a URL to the database, I want my website to show the additional images after a refresh, but it only shows the new images after a server restart. I have tried running putnewvalsinpug() after adding an URL to the database and not only on startup, but that did not work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source