Skip to content
Myr

docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent edb1dc0 · Browse files · 1 file+13 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−10 removed

  • other:+13 added−10 removed

1 file+13 added−10 removed

modified:docs/guide.md+13 added-10 removed
587 unmodified lines
588 // When redirected back to GET /add-to-cart589 // we could check req.session.items && req.session.items.length590 // to print out a message591 if (req.session.items && req.session.items.length) {592 req.flash('info', 'You have %s items in your cart', req.session.items.length);592 req.notify('info', 'You have %s items in your cart', req.session.items.length);593 }594 res.render('shopping-cart');595 });596
116 unmodified lines
713714 req.get('Content-Type', 'boundary');715 // => "--foo-bar-baz"716717### req.flash(type[, msg])717### req.notify(type[, msg])718719Queue flash _msg_ of the given _type_.720721 req.flash('info', 'email sent');722 req.flash('error', 'email delivery failed');723 req.flash('info', 'email re-sent');721 req.notify('info', 'email sent');722 req.notify('error', 'email delivery failed');723 req.notify('info', 'email re-sent');724 // => 2725726 req.flash('info');726 req.notify('info');727 // => ['email sent', 'email re-sent']728729 req.flash('info');729 req.notify('info');730 // => []731732 req.flash();732 req.notify();733 // => { error: ['email delivery failed'], info: [] }734735Flash notification message may also utilize formatters, by default only the %s string formatter is available:735Flash notification message may also utilize formatters, by default only the %s string and %d integer formatters is available:736737 req.flash('info', 'email delivery to _%s_ from _%s_ failed.', toUser, fromUser);737 req.notify('info', 'email delivery to _%s_ from _%s_ failed.', toUser, fromUser);738739Argument HTML is escaped, to prevent XSS, however HTML or the mini-markdown740language you see in use above in the notification format are valid.741742### req.isXMLHttpRequest743744Also aliased as _req.xhr_, this getter checks the _X-Requested-With_ header745to see if it was issued by an _XMLHttpRequest_:
622 unmodified lines