Error flashing messages

please some one help me with a code to display flash messages and fade after some times. actually i try somany methods but cant get it.

const timeout = require('timeout-then');

module.exports = function(app){
  
  
  app.route("/").get(function(req, res, next){
    var info= "am trying"
  this.alertMsg = (function(msg){
   return this.msg = this
   console.log(this.msg);
 }).bind(info);
    //alert function
    this.alertTimeout = setTimeout(function(){
      this.alertMsg.remove()
    }, 3000);
    this.date = new Date();
    this.round;
    this.floor;
    
    this.ceaseAlert = function(){
     this.round = Math.round(this.date.getSeconds());
      this.floor = Math.floor(this.date.getSeconds());
      if(this.floor > this.round){
        clearTimeout(this.alertTimeout)
      }
    }
      
    
    
    
    
      
    res.render(__dirname + "/../views/index.pug", { info: this.alertMsg().toString()})
    
    
 })
}
    

Are you trying to show a UI toast kind of message?

1 Like

dont really get you question but, i simply want to flash message to a user after some time, then the message should fade off.
I have succeeded with DOM and the problem now is embed script with the file link, cause i tried it and its not working