how to sanitize request body in node js
export const registrationSchema = {
"email": {
notEmpty: true,
isEmail: {
errorMessage: "Invalid Email"
}
},
"password": {
notEmpty: true,
isLength: {
options: [{min: 12}],
errorMessage: "Must be at least 12 characters"
},
matches: {
options: ["(?=.*[a-zA-Z])(?=.*[0-9]+).*", "g"],
errorMessage: "Password must be alphanumeric."
},
errorMessage: "Invalid password"
},
"firstName": {
notEmpty: false,
isLength: {
options: [{max: 200}],
errorMessage: "The first name must be under 200 characters"
},
matches: {
options: ["^[a-z ,.'-]+$", "i"],
errorMessage: "The first name can only contain letters and the characters (,.'-)"
}
},
"lastName": {
notEmpty: false,
isLength: {
options: [{max: 200}],
errorMessage: "The last name must be under 200 characters"
},
matches: {
options: ["^[a-z ,.'-]+$", "i"],
errorMessage: "The last name can only contain letters and the characters (,.'-)"
}
}
};
Also in JavaScript:
- nodejs bodyparser form data
- js add item to array
- discord.js clear code
- js select element by css selector
- remove last element from array javascript
- how to count occurences in an array with javascript
- js remove json value duplicates
- javascript ascending and descending
- swap function javascript
- apoolo uselaxyQuery bypass cache
- javascript get browser is electron
- javascript after 2 months date find
- memoization javascript
- package json proxy
- jquery table header agnostic of scroll
- Warning: Failed child context type: Invalid child context `virtualizedCell.cellKey` of type
- angular two datepickers
- javascript popup function
- js module.exports documentation comments
- how to draw a flower in javascript
- jquery make readonly textbox
- how to get browser url in javascript
- JS exercise bank account constructor functions and prototypes solution
- angular material upload file