Files
freeCodeCamp/server/middlewares/validator.js
Berkeley Martinez 6642dd497f Add validation to challenge completion
Change ajax requests to send and accept JSON
to preserve data types.
Fix typos
2016-02-10 22:10:06 -08:00

18 lines
356 B
JavaScript

import validator from 'express-validator';
export default function() {
return validator({
customValidators: {
matchRegex(param, regex) {
return regex.test(param);
},
isString(value) {
return typeof value === 'string';
},
isNumber(value) {
return typeof value === 'number';
}
}
});
}