0.2.1 • Published 6 months ago

yup-x v0.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

YupX

      _____                    _____                    _____
     |\    \                  /\    \                  /\    \                 ______
     |:\____\                /::\____\                /::\    \               |::|   |
     |::|   |               /:::/    /               /::::\    \              |::|   |
     |::|   |              /:::/    /               /::::::\    \             |::|   |
     |::|   |             /:::/    /               /:::/\:::\    \            |::|   |
     |::|   |            /:::/    /               /:::/__\:::\    \           |::|   |
     |::|   |           /:::/    /               /::::\   \:::\    \          |::|   |
     |::|___|______    /:::/    /      _____    /::::::\   \:::\    \         |::|   |
     /::::::::\    \  /:::/____/      /\    \  /:::/\:::\   \:::\____\  ______|::|___|___ ____
    /::::::::::\____\|:::|    /      /::\____\/:::/  \:::\   \:::|    ||:::::::::::::::::|    |
   /:::/~~~~/~~      |:::|____\     /:::/    /\::/    \:::\  /:::|____||:::::::::::::::::|____|
  /:::/    /          \:::\    \   /:::/    /  \/_____/\:::\/:::/    /  ~~~~~~|::|~~~|~~~
 /:::/    /            \:::\    \ /:::/    /            \::::::/    /         |::|   |
/:::/    /              \:::\    /:::/    /              \::::/    /          |::|   |
\::/    /                \:::\__/:::/    /                \::/____/           |::|   |
 \/____/                  \::::::::/    /                  ~~                 |::|   |
                           \::::::/    /                                      |::|   |
                            \::::/    /                                       |::|   |
                             \::/____/                                        |::|___|
                              ~~                                               ~~

Quick Start

Check out our recipes repo to learn how everything works.

Description

YupX lets you deploy an API for your backend using just yup schemas.

Essentially, it does all the work to turn this:

const personSchema = yup.object({
  firstName: yup.string().defined(),
  nickName: yup.string().default('').nullable(),
  sex: yup
    .mixed()
    .oneOf(['male', 'female', 'other'] as const)
    .defined(),
  email: yup.string().nullable().email(),
  birthDate: yup.date().nullable().min(new Date(1900, 0, 1)),
});

Into this:

const express = require('express');
const yup = require('yup');
const router = express.Router();

// Create (POST)
router.post('/person', async (req, res) => {
	// ...
});

// Read (GET)
router.get('/person/:id', async (req, res) => {
	// ...
});

// Update (PUT)
router.put('/person/:id', async (req, res) => {
	// ...
});

// Delete (DELETE)
router.delete('/person/:id', async (req, res) => {
	// ...
});

module.exports = router;

Authors

License

BSD-3-Clause

0.2.1

6 months ago

0.2.0

6 months ago

0.1.0

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago