New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koa-validator

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-validator

a koa port of express-validator

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-21.74%
Maintainers
2
Weekly downloads
 
Created
Source

koa-validator

Build Status NPM version Dependency Status

NPM

a koa port of express-validator

Install

npm install koa-validator

Usage

var koa = require('koa')
    , validator = require('koa-validator')
    , bodyParser = require('koa-bodyparser')

    , app = koa()
    ;

app
    .use(bodyParser())
    .use(validator())
    .use(functon *(next){
        this.checkParams('testparam', 'Invalid number').isInt();
        yield next;
    })
    .listen(3000)

Note

If you will use checkBody or assertBody, you should use one bodyparse middleware before validator.

Test

npm test

API

  • checkParams
  • checkQuery
  • checkBody
  • checkHeader
  • sanitizeParams
  • sanitizeQuery
  • sanitizeBody
  • assertParams => checkParams
  • assertQuery => checkQuery
  • assertBody => checkBody
  • assertHeader => checkHeader
  • onValidationError
  • validationErrors

LICENSE

MIT

Keywords

FAQs

Package last updated on 19 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc