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
    //alert function
    this.alertTimeout = setTimeout(function(){
    }, 3000); = new Date();
    this.ceaseAlert = function(){
     this.round = Math.round(;
      this.floor = Math.floor(;
      if(this.floor > this.round){
    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