function buildMiddleware(records, proxy, onBuild) {
    var app = connect_1.default();
    // Call the onBuild hook
    if (onBuild)
        onBuild(app);
    // Append vhost proxies
    records.forEach(function (record) {
        app.use(vhost_1.vhost(record.match, function (req, res) {
            if (record.onRequest)
                record.onRequest(req, res);
            proxy.web(req, res, __assign({}, record.proxy, { target: record.target }));
        }));
    });
    return app;
}
/**
 * Build a middleware stack with the given record array
 *
 * @private
 * @param records Routing records to setup
 */
Build a middleware stack with the given record array
@private
@param records Routing records to setup
Build a middleware stack with the given record array @private @param records Routing records to setup
function buildMiddleware(records, proxy, onBuild) {
    var app = connect_1.default();
    if (onBuild)
        onBuild(app);
    records.forEach(function (record) {
        app.use(vhost_1.vhost(record.match, function (req, res) {
            if (record.onRequest)
                record.onRequest(req, res);
            proxy.web(req, res, __assign({}, record.proxy, { target: record.target }));
        }));
    });
    return app;
}
function buildMiddleware ( records , proxy , onBuild ) { var app = connect_1 . default ( ) ; if ( onBuild ) onBuild ( app ) ; records . forEach ( function ( record ) { app . use ( vhost_1 . vhost ( record . match , function ( req , res ) { if ( record . onRequest ) record . onRequest ( req , res ) ; proxy . web ( req , res , __assign ( { } , record . proxy , { target : record . target } ) ) ; } ) ) ; } ) ; return app ; }
Build a middleware stack with the given record array
 @private
 @param records Routing records to setup
Build a middleware stack with the given record array @private @param records Routing records to setup
// Call the onBuild hook // Append vhost proxies