2013-03-25 39 views

回答

2

向观看您的网站的用户显示Flash消息。 console.log显示在服务器正在运行的控制台上。

connect-flash是实现Flash消息的中间件。用户下次浏览页面时,用户浏览器上会显示Flash消息。 Flash通常与重定向结合使用,以确保消息可用于要呈现的下一页。这就像是最后一页浏览的提醒。

//go to /flash page 
app.get('/flash', function(req, res){ 
    req.flash('info', 'Hi there!') 
    res.redirect('/'); 
}); 
//info message shown when user sees/home page 
+0

明白了,谢谢! – 2013-03-25 17:34:32

相关问题