<commit_before>// app.js
var pg = require('pg');
var express = require("express");
var app = express();

var connString = 'postgres://zntxnoglkwslwi:<EMAIL>hl4tIsGg<EMAIL>:5432/desc87qe0bn276';


app.use(
     "/",
     express.static(__dirname)
);

app.get('/:secret', function(request, response) {
	var secret = request.params.secret;
	pg.connect(connString, function(err, client, done) {
		if(err) response.send("Could not connect to DB: " + err);

		client.query('SELECT environment FROM sessions WHERE secret = $1', [secret], function(err, result) {
			done();
			if(err) return response.send(err);
			if(result.rows.length == 0) return response.redirect("/");
			return response.send(result.rows[0]);
		});
	});
});

app.get('/save', function(request, response) {
	if(request.method == 'POST') {

		console.log("[200]" + req.method + "to" + req.url);

		request.on('data', function(chunk) {
			console.log("Recieved body data:");
			console.log(chunk.toString());
		});

		response.writeHead(200, "OK", {'Content-Type':'text/html'});
		response.end();
	} else {
		console.log("[405]" + req.method + "to" + req.url);
		response.writeHead(405, "Method not supported", {'Content-Type': 'text/html'});
	    response.end('<html><head><title>405 - Method not supported</title></head><body><h1>Method not supported.</h1></body></html>');
  	}
});

var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
  console.log("Listening on " + port);
});<commit_msg>save function for ajax post request<commit_after>// app.js
var pg = require('pg');
var express = require("express");
var app = express();

var connString = 'postgres://zntxnoglkwslwi:yOyhl4tIsGg1FzI4u0wTchC0HU@ec2-54-204-38-16.compute-1.amazonaws.com:5432/desc87qe0bn276';


app.use("/",
     express.static(__dirname)
);

app.get('/save', function(request, response) {
	if(request.method == 'POST') {
		console.log("[200]" + req.method + "to" + req.url);

		request.on('data', function(chunk) {
			console.log("Recieved body data:");
			console.log(chunk.toString());
		});

		response.writeHead(200, "OK", {'Content-Type':'text/html'});
		response.end();
	} else {
		console.log("[405]" + req.method + "to" + req.url);
		response.writeHead(405, "Method not supported", {'Content-Type': 'text/html'});
	    response.end('<html><head><title>405 - Method not supported</title></head><body><h1>Method not supported.</h1></body></html>');
  	}
});

app.get('/:secret', function(request, response) {
	var secret = request.params.secret;
	pg.connect(connString, function(err, client, done) {
		if(err) response.send("Could not connect to DB: " + err);

		client.query('SELECT environment FROM sessions WHERE secret = $1', [secret], function(err, result) {
			done();
			if(err) return response.send(err);
			if(result.rows.length == 0) return response.redirect("/");
			return response.send(result.rows[0]);
		});
	});
});

var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
  console.log("Listening on " + port);
});
{'fraction_non_alphanumeric': 0.20484727755644092, 'fraction_numerical': 0.028220451527224435, 'mean_word_length': 4.631775700934579, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '837610', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1027, 'n_words': 201}