koa-tcomb-validation
tcomb validation as koa middleware
Description
A koa middleware that checks body/query
request matches with tcomb type, if not valid, return standard 400
http code, or can be intercepted via koa global error handling.
API
validate(type, [location])
type
Type: Function
a type defined with the tcomb library
location
Type: String
Default: body
request property to compare with type object, eg body/query
Usage
const Koa = const bodyParser = const validate = const Router = const app = const router = const body = t // request body will be checkrouter app // global middlewaresapp app app