import express from 'express';
import {middleWares, formBadRequest} from 'nodejs-express-utils';
const app = express();
      id: joi.number().required(),
	  name: joi.string().optional(),
    // data is the validated data returned from the inputJoi middleware
    middleWares.handleResponse((data) => {
		const {id, name} = data;
      	if(!name) {
           return formBadRequest('missing-name');
      	return {data: {}};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter