Skip to content

Add TypeScript support, Upgrade Express

Latest
Compare
Choose a tag to compare
@tinacious tinacious released this 02 Jul 03:57
· 5 commits to main since this release
552aaeb

Adds support for TypeScript usage, e.g.:

import Joi, { SchemaMap } from '@hapi/joi';
import validate from 'express-joi-validate';

const contactSchema: SchemaMap = {
  params: {
    id: Joi.number().required()
  }
};

app.get('/contacts/:id', validate(contactSchema), contactsHandler);

Please note that the explicit declaration of SchemaMap is not necessary as it is inferred.

Express has been upgraded to 4.17.1.