1.0.1 • Published 4 years ago

validator-service-node v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Introduction

Use this package to validate payload data requests coming on your node server.

Installation

Installing with npm

npm i node-validator-service

Installing with yarn

yarn add node-validator-service

Getting Started

  • Set baseSchemaPath for your json schema files.

ValidatorService.init({baseSchemaPath: "schema"})

  • Create validation files in json format.
{
"type": "object",
  "additionalProperties": false,
  "anyOf": [
    {
      "required": [
        "slug"
      ]
    }
  ],
  "properties": {
    "slug": {
      "type": "string"
    }
  }
}
  • Validate request payload

new DemoValidator().validate(inputData)

1.0.1

4 years ago

1.0.0

4 years ago