Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clayrisser/trailpack-express-validator
Trailpack validation for Trails application using express validator
https://github.com/clayrisser/trailpack-express-validator
trails trailsjs validation validator
Last synced: about 1 month ago
JSON representation
Trailpack validation for Trails application using express validator
- Host: GitHub
- URL: https://github.com/clayrisser/trailpack-express-validator
- Owner: clayrisser
- License: mit
- Created: 2017-12-31T23:26:46.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-07-12T10:21:53.000Z (over 1 year ago)
- Last Synced: 2024-12-08T20:53:50.662Z (about 1 month ago)
- Topics: trails, trailsjs, validation, validator
- Language: JavaScript
- Homepage: https://jam.jamrizzi.com
- Size: 1.09 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trailpack-express-validator
Trailpack validation for Trails application using express validator
![](assets/trailpack-express-validator.png)
## Usage
```sh
npm install --save trailpack-express-validator
``````js
// api/validators/SomeValidator.jsimport Validator from 'trailpack-express-validator/validator';
export default class UserValidator extends Validator {
register() {
return {
body: {
firstName: {
notEmpty: true
},
lastName: {
notEmpty: true
},
email: {
isEmail: true
},
username: {
notEmpty: true
},
password: {
notEmpty: true
}
}
};
}login() {
return {
body: {
email: {
isEmail: true
},
password: {
notEmpty: true
}
}
};
}
}
``````js
// config/validators.jsexport default {
UserController: {
register: ['UserValidator.register'],
login: ['UserValidator.login']
}
};
```