title: Using custom flash messages, and calling them. (Nodejs)
body: <p>Okay, so I am only currently trying to figure out how show certain types of messages in EJS. I am using this now, which works:</p>
  
  <pre><code>    let sql = 'SELECT * FROM users WHERE username = ?';
      db.query(sql, [username], function(err, rows) {
        if (err)
          return done(err);
        if (!rows.length) {
          return done(null, false, {
            type: 'loginMessage',
            message: 'Login',
          });
        }
  
        //  Match Password
        bcrypt.compare(password, rows[0].password, function(err, isMatch) {
          if (err)
            return done(err);
          if (isMatch) {
            return done(null, rows[0]);
          } else {
            return done(null, false, {
              type: 'loginMessage',
              message: 'Wrong Login',
            });
          }
        });
      });
    }));
  </code></pre>
  
  <p>That's where the messages come from. However I am having issues rendering them 1 type at a time.</p>
  
  <pre><code>&lt;%- messages('msg_temp', locals) %&gt;
  </code></pre>
  
  <p>Is how I'm doing it, but that shows every type. I would like to have two of these, one above login and one above register with <code>'loginMessage'</code> as the login type and <code>'regMessage'</code> as the register type.</p>
  
  <p>Is you want to see exactly what I'm trying to do, you can go to <a href="https://playkog.net" rel="nofollow noreferrer">https://playkog.net</a></p>
  
  <p>If you try to register itll show the messages above login. (etc etc). </p>