{"size": 992, "ext": "js", "max_stars_repo_path": "src/proxy/index.js", "max_stars_repo_name": "ovcharenko-di/onecover-nodeproxy", "max_stars_repo_stars_event_min_datetime": "2018-05-23T15:13:18.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-31T11:40:40.000Z", "max_issues_repo_path": "src/proxy/index.js", "max_issues_repo_name": "ovcharenko-di/onecover-nodeproxy", "max_issues_repo_issues_event_min_datetime": "2018-05-30T10:52:56.000Z", "max_issues_repo_issues_event_max_datetime": "2019-11-05T16:01:34.000Z", "max_forks_repo_path": "src/proxy/index.js", "max_forks_repo_name": "ovcharenko-di/onecover-nodeproxy", "max_forks_repo_forks_event_min_datetime": "2019-09-04T09:35:39.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-12T16:23:43.000Z"}
{"max_stars_count": 16, "max_issues_count": 3, "max_forks_count": 8, "avg_line_length": 25.4358974359, "max_line_length": 92, "alphanum_fraction": 0.6441532258}
var debugerURL = process.env.DEBUGER_URL;
var proxyPort = process.env.PROXY_PORT;
var proxyResultDir = process.env.PROXY_RESULT_DIR;

var express = require('express');
var app = express();
var httpProxy = require('http-proxy');
var apiProxy = httpProxy.createProxyServer();
var log = require('intel');

log.addHandler(new log.handlers.File(proxyResultDir));
log.addFilter(new log.Filter(/.*d2p1:measure.*/));
var parseString = require('xml2js').parseString;


app.all("/*", function (req, res) {

    var jsonStringreq = '';
    req.on('data', function (data) {
        jsonStringreq += data;
    });

    req.on('end', function () {

        parseString(jsonStringreq, {trim: true, explicitArray:false}, function(err, result){
            log.info(JSON.stringify(result));
        });
      
        // log.info(jsonStringreq);
        // log.info(req.originalUrl);
        // log.info(req.headers);

    });
 
    apiProxy.web(req, res, { target: debugerURL });

});

app.listen(proxyPort);