Nocturnal Pumpkin Maelstrom

    @jych/glee

    0.1.1-1 • Public • Published

    Glee

    Glee is a JavaScript package that provides Express middleware for request and response validation.

    The middleware uses Joi - the popular Hapi-ecosystem validation library - for validation and validates request path params, query params, headers, and body, and the response headers and body.

    Glee aims to provide a Hapi-like validation experience for the Express ecosystem.

    Online Documentation
    GitHub Repo
    NPM Package

    Installation

    Install using yarn:

    yarn add @jych/glee

    or npm:

    npm install @jych/glee

    Example Usage

    Using Glee is as simple as creating a Glee instance and then passing a Joi Schema to one of it's "get validator" methods. The result is an Express Middleware.

    import express, { Request, Response } from 'express'
    import { Glee } from '@jych/glee'
    import Joi from '@hapi/joi';
    
    const schema = Joi.object();
    
    const glee = new Glee();
    const queryValidatorMw = glee.getQueryValidator(schema);
    
    const app = express();
    
    app.get(
    	'/',
    	queryValidatorMw,
    	(req: Request, res: Response) => {
    		res.status(200).send('Hello world!');
    	}
    );

    Contributing

    Pull requests are welcome. Please report issues on the issue traker.

    License

    Glee uses the MIT license.

    Keywords

    none

    Install

    npm i @jych/glee

    DownloadsWeekly Downloads

    0

    Version

    0.1.1-1

    License

    MIT

    Unpacked Size

    13.1 kB

    Total Files

    17

    Last publish

    Collaborators

    • jych