我试图在connect flash-express中请求一个类型为多个flash消息,并给我多个字符串消息,但不是“type”
途中:

  app.get '/multiple-flash', (req, res) ->
    req.flash "info", ["Welcome", "Benvenuto"]
    res.redirect '/'

在客户端:
doctype 5
html
  head
    title= 'Login'

  body
    p layout

      if message
        p= message

    -console.log(message)

在本地主机上获取/多个flash,但控制台中的输出不显示“type”。
GET /multiple-flash 302 1ms - 90
[ [ 'Welcome', 'Benvenuto', ] ]

我该怎么解决?谢谢

最佳答案

我希望这对那些有同样问题的人有帮助。
在路线“/”中将是:

  app.get '/', (req, res) ->
    res.render '',
      message: req.flash()

以前的错误是:
message: req.flash ('info')

只返回信息的闪光。

关于node.js - Connect-Flash和Express给我多条消息,但没有输入,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13092668/

10-14 22:56
查看更多