【文件属性】:
文件名称:simple-flash:快速消息使 Express 变得简单
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-19 12:17:27
JavaScript
简单闪光
Simple Flash 是一种在 Express 路由中设置 Flash 消息的非常简单的方法。
安装
npm install simple-flash
用法
在您的 app.js 中(在会话设置行之后):
var flash = require ( 'simple-flash' ) ;
app . use ( flash ( ) ) ;
在您的路线中,仅使用新功能req.flash(type,message)添加您的消息:
app . post ( '/foo' , function ( req , res ) {
try {
// your awesom code here
req . flash ( 'success' , 'Your success message here!' ) ;
res . red
【文件预览】:
simple-flash-master
----.gitignore(27B)
----package.json(748B)
----LICENSE(1KB)
----index.js(546B)
----README.md(1KB)
----.npmignore(12B)
----test()
--------main.js(2KB)