Skip to content

pepesoriagarcia99/body-schema-validator

Repository files navigation

body-schema-validator

Install

npm install --save body-schema-validator

Usage

Bodymen allows you to define a schema to control the fields sent through the request body.

import { body } from "body-schema-validator"

app.post('/posts', body({
  title: {
    type: String,
    required: true,
    trim: true,
    minlength: 3
  },
  content: {
    type: String,
    required: true,
    minlength: 32
  },
  tags: [String]
}), 
(req, res) => {
  console.log(req.bodymen.body) // will contain the parsed body
})

License

MIT © Jose Eduardo Soria

About

About Body parser middleware for MongoDB, Express and Nodejs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published