function requireAuth(request, response, next) {
	if (Object.values(draftAuthInfo).all(function (i) { typeof i !== 'undefined' && i.length > 0; })) {
		var user = basicAuth(request);

		if (!user || user.name !== draftAuthInfo.user || user.pass !== draftAuthInfo.pass) {
		  response.set('WWW-Authenticate', 'Basic realm=Authorization Required');
		  return response.status(401).send('You have to say the magic word.');
		}
	}
    next();
}
// Middleware to require auth for routes
Middleware to require auth for routes
Middleware to require auth for routes
function requireAuth(request, response, next) {
	if (Object.values(draftAuthInfo).all(function (i) { typeof i !== 'undefined' && i.length > 0; })) {
		var user = basicAuth(request);
		if (!user || user.name !== draftAuthInfo.user || user.pass !== draftAuthInfo.pass) {
		  response.set('WWW-Authenticate', 'Basic realm=Authorization Required');
		  return response.status(401).send('You have to say the magic word.');
		}
	}
    next();
}
function requireAuth ( request , response , next ) { if ( Object . values ( draftAuthInfo ) . all ( function ( i ) { typeof i !== 'undefined' && i . length > 0 ; } ) ) { var user = basicAuth ( request ) ; if ( ! user || user . name !== draftAuthInfo . user || user . pass !== draftAuthInfo . pass ) { response . set ( 'WWW-Authenticate' , 'Basic realm=Authorization Required' ) ; return response . status ( 401 ) . send ( 'You have to say the magic word.' ) ; } } next ( ) ; }
Middleware to require auth for routes
Middleware to require auth for routes