Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/posquit0/koa-legit
:traffic_light: Koa middleware to validate and sanitize HTTP request
https://github.com/posquit0/koa-legit
koa koa-middleware koa-validator node-module node-validator sanitizer validation validator
Last synced: about 1 month ago
JSON representation
:traffic_light: Koa middleware to validate and sanitize HTTP request
- Host: GitHub
- URL: https://github.com/posquit0/koa-legit
- Owner: posquit0
- License: mit
- Created: 2017-10-15T09:46:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T07:31:26.000Z (over 6 years ago)
- Last Synced: 2024-10-01T02:21:19.603Z (about 2 months ago)
- Topics: koa, koa-middleware, koa-validator, node-module, node-validator, sanitizer, validation, validator
- Language: JavaScript
- Size: 24.4 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
:traffic_light: Koa middleware to validate and sanitize HTTP request
**Koa Legit** is a Koa middleware to easily validate HTTP request data including headers, cookies, body, query strings, and url params. It's based on [validator](https://github.com/chriso/validator.js).
- It was written for us on [**OMNIOUS**](http://www.omnious.com) which provides fashion A.I API service.
## Installation
```bash
# NPM
$ npm install --save koa-legit
# Yarn
$ yarn add koa-legit
```## Example
```node
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const legit = require('koa-legit');
const Router = require('koa-router');const app = new Koa();
// Set middlewares
app.use(bodyParser({ enableTypes: ['json', 'form'] }));
app.use(legit());// Bootstrap application router
const router = new Roter();
app.use(router.routes());
app.use(router.allowedMethods());app.listen(3000);
```## API
To be updated
## Contributing
This project follows the [**Contributor Covenant**](http://contributor-covenant.org/version/1/4/) Code of Conduct.
#### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/posquit0/koa-legit/issues) to report any bugs or ask feature requests.
## Self Promotion
Like koa-legit? Follow the repository on [GitHub](https://github.com/posquit0/koa-legit). And if you're feeling especially charitable, follow [posquit0](https://posquit0.com) on [GitHub](https://github.com/posquit0).
## Contact
If you have any questions, feel free to join me at [`#posquit0` on Freenode](irc://irc.freenode.net/posquit0) and ask away. Click [here](https://kiwiirc.com/client/irc.freenode.net/posquit0) to connect.
## License
Provided under the terms of the [MIT License](https://github.com/posquit0/koa-legit/blob/master/LICENSE).
Copyright © 2017, [Byungjin Park](http://www.posquit0.com).