node-obligatory
Obligatory parameters that are required in REST API body.
How to Install.
Simply run the following command:
npm install obligatory --save
How to use:
Obligatory validates the given collection with the mandatory properties:
{ var obligatory = ; app;};
If you don't want the code to throw the exception and want to catch missing fields, try this:
var validator = obligatory; validatoremail = true; validatorpassword = true; validator; validator;
Optionally, you can put flag
for strict mode to see if you just want existence of key or value as well.
validator;// ORvalidator;
Obligatory helps to define clean pattern to validate your REST API body parameters.
Contribution.
Module is under maintainence by Hamza Waqas but you can also create issues or send a pull-request! That's how all works :-)