@jiango/validation
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

jiango-node-validation

jiango validation module

Quick start

$ npm i @jiango/validation

app.js

'use strict';

const app = module.exports = require('jiango')();

app.setup('@jiango/validation');

app.router.post('/simple', ctx => {
  ctx.validate('simple'); // default data: ctx.request.body
  ctx.body = 'ok';
});

app.start();

validation/simple.schema.json

{
  "type": "object",
  "properties": {
    "foo": { "type": "number", "minimum": 0 },
    "bar": { "type": "string", "maxLength": 10, "minLength": 2 }
  },
  "required": ["foo", "bar"],
  "additionalProperties": false
}

Package Sidebar

Install

npm i @jiango/validation

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

3.88 kB

Total Files

4

Last publish

Collaborators

  • yefei777