在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:rickharrison/koa-flash开源软件地址:https://github.com/rickharrison/koa-flash开源编程语言:JavaScript 97.4%开源软件介绍:#koa-flash Flash messages for your koa application. Installation$ npm install koa-flash koa-flash also depends on koa-session. You must add koa-session as a middleware prior to adding koa-flash as seen in the example: Examplevar koa = require('koa')
, session = require('koa-session')
, flash = require('koa-flash');
var app = koa();
app.keys = ['foo'];
app.use(session());
app.use(flash());
app.use(function *() {
if (this.method === 'POST') {
this.flash = { error: 'This is a flash error message.' };
} else if (this.method === 'GET') {
this.body = this.flash.error || 'No flash data.';
}
});
app.listen(3000); SemanticsFlash data when set will be saved to the user's session for exactly one more request. You can save any javascript object into OptionsFlash data is saved into app.use(flash({ key: 'foo' })); Also, you can set app.use(flash({ defaultValue: 'bar' })); LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论