function Server(records, config) {
        var _this = this;
        this.onBuild = config.onBuild;
        this.proxy = http_proxy_1.default.createProxyServer(config && config.proxy);
        this.stack = buildMiddleware(records || [], this.proxy, this.onBuild);
        this.records = records;
        // Call proxy handler
        if (config.onProxy) {
            config.onProxy(this.proxy);
        }
        // Manually hand off the request to the middleware stack
        var handler = function (req, res) { return _this.stack(req, res); };
        // Create the HTTP and HTTPS server
        this.http = http_1.default.createServer(handler);
        if (config.https) {
            this.https = https_1.default.createServer({
                SNICallback: function (hostname) { return resolveCertificate(_this.records, hostname); }
            }, handler);
        }
    }
/**
     * Initialize a new Server instance.
     *
     * @param records Array of HTTP or HTTPS records
     * @param config Server configuration
     */
Initialize a new Server instance.
@param records Array of HTTP or HTTPS records
@param config Server configuration
Initialize a new Server instance . @param records Array of HTTP or HTTPS records @param config Server configuration
function Server(records, config) {
        var _this = this;
        this.onBuild = config.onBuild;
        this.proxy = http_proxy_1.default.createProxyServer(config && config.proxy);
        this.stack = buildMiddleware(records || [], this.proxy, this.onBuild);
        this.records = records;
        if (config.onProxy) {
            config.onProxy(this.proxy);
        }
        var handler = function (req, res) { return _this.stack(req, res); };
        this.http = http_1.default.createServer(handler);
        if (config.https) {
            this.https = https_1.default.createServer({
                SNICallback: function (hostname) { return resolveCertificate(_this.records, hostname); }
            }, handler);
        }
    }
function Server ( records , config ) { var _this = this ; this . onBuild = config . onBuild ; this . proxy = http_proxy_1 . default . createProxyServer ( config && config . proxy ) ; this . stack = buildMiddleware ( records || [ ] , this . proxy , this . onBuild ) ; this . records = records ; if ( config . onProxy ) { config . onProxy ( this . proxy ) ; } var handler = function ( req , res ) { return _this . stack ( req , res ) ; } ; this . http = http_1 . default . createServer ( handler ) ; if ( config . https ) { this . https = https_1 . default . createServer ( { SNICallback : function ( hostname ) { return resolveCertificate ( _this . records , hostname ) ; } } , handler ) ; } }
Initialize a new Server instance.
Initialize a new Server instance .
// Call proxy handler // Manually hand off the request to the middleware stack // Create the HTTP and HTTPS server