-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to add validation to nedb? #7
Comments
It doesn't look like your extended code would work the way I'd expect it. Did you look at the guide for using hooks for validation? A simple extended validator can look like this: apiService = nedb('api').extend({
create: function(data, params, cb) {
if(!data.name) {
return cb(new errors.BadRequest('Name needs to be provided'));
}
return this._super(data, params, cb);
}
}); If you now try to submit data without a |
merci vielmals :) |
🎉 Glad that worked for you! @akralj I did also notice that you had |
@ekryski |
hi all. I am trying to include a validator on post requests and I am pretty lost. I don't know how to add a proper response for the browser. i tried it with hooks and all sorts of others things, but no luck.
I get an exception in the browser with the code below.
and the following client request:
Feathers in build error messages work fine when trying a GET to a missing id, but not my own validator.
thanks a lot and happy new year.
The text was updated successfully, but these errors were encountered: