Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
connect-flash shows [ ] instead of a message (express)
      ... 
      newArticle.save((err,newArticle)=>{
      if(err){
        req.flash('error','Sorry , an error has occured. Thamk you try again later')
        //when i use console.log(req.flash('error')) it shows normally in the terminal
        return res.redirect('/AddArticle')
      }else{
        req.flash('success','Thank you , your article has been added')
        //when i use console.log(req.flash('success')) it shows normally in the terminal
        return res.redirect('/AddArticle')
      }
    })
}

  

this is the route fonction:

  router.post('/AddFormArticle',control.FormAddArticle)

this is control FormAddArticle function that i used to render the flash message and the page:

  exports.FormAddArticle = (req,res)=>{
  res.render('FormArticle',{title : "Ajouter un Article" , success : req.flash('success') , 
  error : req.flash('error') })
  
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!