3.0.1 • Published 1 year ago

@zenweb/validation v3.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

zenweb-validation

zenweb validation module

Quick start

$ npm i @zenweb/validation

app.js

'use strict';

const { default: validation } = require('@zenweb/validation');
const app = module.exports = require('zenweb').create();

app.setup(validation());
app.start();

app/controller/simple.js

const app = require('../../app');

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

app/validation/simple.schema.json

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

1 year ago

3.0.0

2 years ago

2.3.2

2 years ago

2.3.3

2 years ago

2.3.0

3 years ago

2.3.1

3 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago