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.