mongoose - Node.js rest api validate incoming json from url -


i have simple rest api excepts json in url through request.

i have mongoose schema , validate incoming json in correct format.

can mongoose alone?

yes, can create document parsed json using model , validate.

// assuming having parsed json yet var doc = mymodel(json.parse(json_from_url)); doc.validate(function(err) {...}); 

note: mongoose queries validate document before saving database.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -