{"id":8037,"date":"2015-11-21T13:58:48","date_gmt":"2015-11-21T13:58:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/21\/how-to-send-a-flash-message-with-res-redirect-sails-js-open-source-projects-balderdashy-sails\/"},"modified":"2022-08-30T15:03:03","modified_gmt":"2022-08-30T15:03:03","slug":"how-to-send-a-flash-message-with-res-redirect-sails-js-open-source-projects-balderdashy-sails","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/21\/how-to-send-a-flash-message-with-res-redirect-sails-js-open-source-projects-balderdashy-sails\/","title":{"rendered":"how to send a flash message with res.redirect(&#39;\/&#39;) sails js-open source projects balderdashy\/sails"},"content":{"rendered":"<p>How to send a flash message with <code>res.redirect('\/')<\/code> in Sails?<\/p>\n<p>When i check some condition in a controller then I want to redirect to another url, passing along a flash message.<\/p>\n<p>I am new to Sails, so any help will be appreciated.<\/p>\n<p>Controller action:<\/p>\n<pre><code>module.exports ={\n   index: function (req, res) {\n\n    if(req.param('key')){\n      req.flash('message', 'welcome key is present');\n      res.redirect('\/view\/');\n    } else {\n      req.flash('message', 'welcome key is not present');\n      res.redirect('\/');\n    }\n\n  }\n}\n<\/code><\/pre>\n<p>Thanks in advance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to send a flash message with res.redirect(&#8216;\/&#8217;) in Sails? When i check some condition in a controller then I want to redirect to another url, passing along a flash message. I am new to Sails, so any help will be appreciated. Controller action: module.exports ={ index: function (req, res) { if(req.param(&#8216;key&#8217;)){ req.flash(&#8216;message&#8217;, &#8216;welcome key [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8037","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8037"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8037\/revisions"}],"predecessor-version":[{"id":8674,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8037\/revisions\/8674"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}