Package Exports
- next-validations
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-validations) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Welcome to next-validations 👋
NextJS API Validations
🏠 Homepage
✨ Demo

Prerequisites
- node >=10
- nextjs >= 9
Install
yarn add next-validationsUsage
Validate custom API endpoint with Yup
yarn add yup next-validationsimport { 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 testAuthor
👤 Huynh Duc Dung
- Website: https://productsway.com/
- Twitter: @jellydn
- Github: @jellydn
Show your support
Give a ⭐️ if this project helped you!

This README was generated with ❤️ by readme-md-generator