2.0.7 • Published 3 months ago

thorin-plugin-joi v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Thorin.js request session utility

Full documentation available at https://thorinjs.com

Plugin specific documentation available at https://thorinjs.com/plugin/sentry

Usage

'use strict';
const thorin = require('thorin');

thorin.addPlugin(require('thorin-plugin-joi'));

thorin.run(async () => {
  const joiObj = thorin.plugin('joi'),
    Joi = joiObj.Joi;

  const schema = joiObj.schema(() => Joi.object({
    domain: Joi.domain().optional()
  }));
  try {
    const unvalidatedData = {
      my: 'data',
      domain: 'john.com'
    }
    const result = await joiObj.validate(schema, unvalidatedData);
    console.log(result, unvalidatedData);
  } catch (e) {
    console.log(e, e.data.fields);
  }
})
2.0.7

3 months ago

2.0.6

5 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago