<commit_before>/**
 * @file
 * Main app file that will create a (default: localhost) proxy to wrap remote JSON requests.
 *
 * @author (<EMAIL>)
 */


var http = require('http')
  , fs = require('fs')
  , config = {
			hostname : '127.0.0.1',
			port : 3085
		}
  , config_path = './config.json'


/**
 * Create server.
 */
fs.exists(config_path, function(exists) {
	// load any additional or overriding config
	if (exists) {
		var config_json = require('./config.json')
		for (var c in config_json) {
			config[c] = config_json[c]
		}
		console.log("Config loaded: " + JSON.stringify(config))
	}

	// starts the http server
	http.createServer(json_proxy).listen(config.port, config.hostname, function(){
	  console.log("Server listening on port " + config.port)
	})
})



function json_proxy(req, res) {

	var requested_url = decodeURIComponent(req.url.replace(/^\//, ''))
	console.log("Requested URL to be proxied: " + requested_url)
<commit_msg>added some doc<commit_after>/**
 * @file
 * Main app file that will create a (default: localhost) proxy to wrap remote JSON requests.
 *
 * @author (<EMAIL>)
 */


var http = require('http')
  , fs = require('fs')
  , config = {
			hostname : '127.0.0.1',
			port : 3085
		}
  , config_path = './config.json'


/**
 * Create server.
 */
fs.exists(config_path, function(exists) {
	// load any additional or overriding config
	if (exists) {
		var config_json = require('./config.json')
		for (var c in config_json) {
			config[c] = config_json[c]
		}
		console.log("Config loaded: " + JSON.stringify(config))
	}

	// starts the http server
	http.createServer(json_proxy).listen(config.port, config.hostname, function(){
	  console.log("Server listening on port " + config.port)
	})
})


/**
 * Does the actual job: proxies remote JSON response to set hostname.
 * @param req node [Object]
 * @param res node [Object]
 */
function json_proxy(req, res) {

	var requested_url = decodeURIComponent(req.url.replace(/^\//, ''))
	console.log("Requested URL to be proxied: " + requested_url)

{'fraction_non_alphanumeric': 0.15467980295566502, 'fraction_numerical': 0.009852216748768473, 'mean_word_length': 3.5640449438202246, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5402574', 'n_tokens_mistral': 720, 'n_tokens_neox': 671, 'n_words': 181}