Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add validator #3

Open
llun opened this Issue Oct 25, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

llun commented Oct 25, 2012

Currently user have to put validator in handler or facade layer to check basic input, separate it to new layer or class would make it more clean.

config should look like this after add validator

'get:path': { facade: 'Class.method', validator: 'SampleValidator' }

and SampleValidator class should have only one method to check input

var SampleValidator = function() {
    //constructor defined pattern or fields
}
SampleValidator.prototype.check = function (input, callback) {
    result = { validate: true/false, fields: [] };
    callback(result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment