title: Validate request parameters in SailsJS
body: <p>In SailsJS, I would like to validate request parameters using the same mechanism as when models are validated when model actions are performed.</p>
  
  <p>So when you define a model you use the "attributes" option to specify your parameter properties, and they are then used for validation.</p>
  
  <p>But what if you'd like to validate say a login form or email form on the server side, thus there is no model needed for it and you'd just like to validate the parameters?</p>
  
  <p>So I'd like to be able to do something like this:</p>
  
  <pre><code>//login validation
  req.validate({
     email: { required: true, email: true },
     password: { required: true }
  });
  
  //send email validation
  req.validate({
     subject: { required: true, type: 'string' },
     to: { required: true, type: 'string' },
     body: { required: true, type: 'string' }
  });
  </code></pre>
  
  <p>A function <code>req.validate</code> is mixed in for all requests and called if <code>req.options.usage</code> is set for the request, I've played with that a bit but I don't quite understand what it's doing. There is no documentation on this nor in <code>"anchor"</code> which is what's used for the validation.</p>
  
  <p>Any help or suggestions on how I could achieve this (preferably with some undocumented SailsJS feature)?</p>