simple validation middleware
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tests
.gitignore
.travis.yml
README.md
package.json

README.md

This is apache 2.0. Fork it. If you do a good job at it I will use your thing instead of mine.

INSERT MEME

build status

How it works if you have something in production or something:

module.exports = function routes(app) {
  app.get('/', function (req, res) {
    res.render('index');
  });

  app.post('/create-an-account', [require('./validate/account')], function (req, res) {
    res.render('account_created');
  });

};

Validation code looks something like this:

var val = require('val')();

module.exports = val.validate([{
  required: 'email'
  }, {
  required: 'password'
  }], function on_error(err, req, res, next) {
  res.render('account_created', {
    flash: err.message
  });
});

TOTAL WATEVS