0.4.2 ā€¢ Published 2 months ago

next-validations v0.4.2

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

Welcome to next-validations šŸ‘‹

Version Prerequisite License: MIT Twitter: jellydn

NextJS API Validations

šŸ  Homepage

āœØ Demo

https://gyazo.com/bf4582f7b7aa0f0ae67c4cc337c4e974.gif

Prerequisites

  • node >=10
  • nextjs >= 9

Install

yarn add next-validations

Usage

Validate custom API endpoint with Yup

yarn add yup next-validations
import { withValidation } from 'next-validations';
import * as yup from 'yup';

const schema = yup.object().shape({
  name: yup.string().required(),
});

const validate = withValidation({
  schema,
  type: 'Yup',
  mode: 'query',
});

const handler = (req, res) => {
  res.status(200).json(req.query);
};

export default validate(handler);

Run tests

yarn test

Author

šŸ‘¤ Huynh Duc Dung

Show your support

Give a ā­ļø if this project helped you!

support us(https://img.shields.io/badge/become-a patreon%20us-orange.svg?cacheSeconds=2592000)


This README was generated with ā¤ļø by readme-md-generator

1.0.0-1

2 months ago

1.0.0-0

2 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.4.2

6 months ago

0.3.3

11 months ago

0.3.2

1 year ago

0.3.0-0

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.12-0

2 years ago

0.1.11

2 years ago

0.1.10

3 years ago

0.1.9-0

3 years ago

0.1.8

3 years ago

0.1.8-2

3 years ago

0.1.8-1

3 years ago

0.1.8-0

3 years ago

0.1.7

3 years ago

0.1.7-0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.2-0

3 years ago

0.1.1

3 years ago

0.1.1-1

3 years ago

0.1.1-0

3 years ago