use-yup
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

useYup

The friendly typescript-compatible express middlewere and react hook.

Installation

Using npm:

npm install use-yup

or if you prefer to use the yarn package manager:

yarn add use-yup

Usage

import { useYup } from 'use-yup';
import * as express from 'express';

const app = new express();

const userObject = yup.object({
    id: yup.string(),
    username: yup.string()
});

app.post("/endpoint", useYup(userObject, (req) => req.query), (req: UseYupRequest<typeof userObject>, res) => {
    res.send(`Id: ${req.yupData.id} | Username: ${req.yupData.username}`);
});

app.listen(1234, () => {
    console.log('Application is live!');
});

Package Sidebar

Install

npm i use-yup

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

2.47 kB

Total Files

6

Last publish

Collaborators

  • lucemans