title: Sending an error message to the users in router with nodejs
body: <p>The users on my website can change their passwords.</p>
  
  <p>The problem is that when the server produces an error in the process I have to set a warning message and say something like this:</p>
  
  <pre><code>'Warning, the password couldn't be changed, please try again!'
  </code></pre>
  
  <p>I made two routes in express</p>
  
  <pre><code>app.get('/editMode/:user',ensureAuthUser,routes.user.editMode);
  app.get('/editMode/:user/:message',ensureAuthUser,routes.user.editMode);
  </code></pre>
  
  <p>The first shows the editMode template<br>
  The second is supposed to show the editMode and a message from the server</p>
  
  <p>In the editMode.js</p>
  
  <pre><code>var warn=null;
      if(req.params.message) warn=validWarn(req.params.warn) ?JSON.parse(req.params.message) :null;
      console.log('message value: '+req.params.message);
      console.log('warn value: '+warn);
  </code></pre>
  
  <p>In both cases when I redirect to /editMode/+'email@user.com'+/+'warning message' or 
  /editMode/+'email@user.com' I get</p>
  
  <pre><code>console.log(req.params.message)// value: undefined
  console.log(warn)// value: null
  </code></pre>
  
  <p>Why can't I send a message to the user if my db can't change the password?</p>
  
  <p>EDIT 2</p>
  
  <p>editMode render</p>
  
  <pre><code>return res.render('templates/edit_template,
                              {
                                  title: title,
                                  usuario: req.session.passport.user,
                                  warning: warn || null,
                              })
  </code></pre>
  
  <p>in the template edit_template.jade</p>
  
  <pre><code>-if(warning &amp;&amp; warning.length)
                      h2 Error: #{warning}
                  -else
                      h2 success
  </code></pre>