function requestListener( opts ) {
	return onRequest;

	/**
	* Callback invoked upon receiving an HTTP request when serving a directory.
	*
	* @private
	* @param {IncomingMessage} request - HTTP request object
	* @param {ServerResponse} response - HTTP response object
	*/
	function onRequest( request, response ) {
		var path;

		debug( 'Received a request for %s', request.url );

		// Resolve the directory path, making sure to guard against attempts to access parent directories...
		path = request.url.substring( 1 ); // remove leading `/`
		path = resolve( opts.dir, path );
		if ( path.substring( opts.dir.length ) === '' ) {
			path = opts.dir;
		}
		debug( 'Request resolved to path %s', path );
		debug( 'Reading directory' );
		readDir( path, onDir );

		/**
		* Callback invoked after reading a directory's contents.
		*
		* @private
		* @param {(Error|null)} error - error object
		* @param {StringArray} contents - directory contents
		* @returns {void}
		*/
		function onDir( error, contents ) { // eslint-disable-line no-unused-vars
			if ( error ) {
				if (
					error.code === 'ENOENT' ||
					error.code === 'ENOTDIR'
				) {
					// Return a `404` response...
					return notFound( response );
				}
				// TODO
			}
			// TODO
		}
	}
}
Returns a request listener for serving a directory.

@private
@param {Options} opts - server options
@param {string} opts.dir - directory to serve
@returns {Function} request listener