<commit_before>#!/usr/bin/env node


var pg = require('pg');

var conString = "postgres://mike:test@192.168.3.22/couchplay";


pgclient = new pg.Client(conString);

pgclient.connect(function(err) {
            if (err) {
                console.error('ERROR: Could not connect to postgres', err);
                process.exit();
            } else {
                console.log('Connected to postgres');
            }
});



var http = require("http");
var url = require("url") ;
var control_port = 8086;


function onRequest(request, response) {
    response.writeHead(200, {
        "Content-Type": "text/plain"
    });

//    console.log(request.url);

    var queryObject = url.parse(request.url,true);
//    console.log(queryObject);


    switch (queryObject.pathname) {
        case '/query':

           // response.write("Pretend to be influx\n");            
            //response.write("SQL: " + queryObject.query.q + "\n"); 

            console.log(queryObject.query.q);<commit_msg>cors stiuff<commit_after>#!/usr/bin/env node


var pg = require('pg');

var conString = "postgres://mike:test@192.168.3.22/couchplay";


pgclient = new pg.Client(conString);

pgclient.connect(function(err) {
            if (err) {
                console.error('ERROR: Could not connect to postgres', err);
                process.exit();
            } else {
                console.log('Connected to postgres');
            }
});



var http = require("http");
var url = require("url") ;
var control_port = 8086;


function onRequest(request, response) {

        response.setHeader('Access-Control-Allow-Origin', '*');
        response.setHeader('Access-Control-Request-Method', '*');
        response.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
        response.setHeader('Access-Control-Allow-Headers', '*');
        if ( request.method === 'OPTIONS' ) {
                response.writeHead(200);
                response.end();
                return;
        }

    response.writeHead(200, {
        "Content-Type": "text/plain"
    });


//    console.log(request.url);

    var queryObject = url.parse(request.url,true);
//    console.log(queryObject);


    switch (queryObject.pathname) {
        case '/query':

           // response.write("Pretend to be influx\n");            
            //response.write("SQL: " + queryObject.query.q + "\n"); 

            console.log(queryObject.query.q);
{'fraction_non_alphanumeric': 0.15763342987174184, 'fraction_numerical': 0.014480761274306992, 'mean_word_length': 2.1899736147757256, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '6383720', 'n_tokens_mistral': 772, 'n_tokens_neox': 706, 'n_words': 128}