<commit_before>var express = require('express');
var app = express();
var bodyParser=require('body-parser'); // required for AJAX POST
var mongodb = require('mongodb'); // mongodb package for node
var mc = mongodb.MongoClient;
var url='mongodb://localhost:27017/test';

// connecting to the mongo db server
mc.connect(url,function(err,db){
	if(!err){
		console.log("Connected!");
	}
	collection=db.collection('sample');
});

app.set('port',5000);

app.use(express.static(__dirname+'/public')); // directory for all css and js
app.use('/favicon.ico', express.static('images/favicon.ico'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));

app.set('views',__dirname+'/views'); // directory for all ejs files
app.set('view engine','ejs'); // using .ejs instead of .html

app.get('/ledger/login',function(req,res){
	console.log("GET /ledger/login")
	res.render("login.ejs")
})
// GET /ledger
app.get('/ledger',function(request,response){
	console.log("GET /ledger")
	response.render("ledger_home.ejs");
});

// POST /ledger (called when the button is clicked)
app.post('/ledger',function(request,response){
	console.log("POST /ledger")
	var test=request.body;
	collection.insert({"id":1,"name":test['msg']});
	console.log("Inserted!");
	collection.find({}).toArray(function(err, docs) {
    	console.log("Found the following records");
    	// Printing all the documents in the sample in a nested JSON format
    	console.dir(docs);
    	// Sending back the third JSON document
    	response.send(docs[2]);
  	});
});

// Listening on 127.0.0.1:5000
app.listen(app.get('port'),function(){
	console.log("Node app is running on localhost:",app.get('port'));
});<commit_msg>checking /ledger/react-check<commit_after>var express = require('express');
var app = express();
var bodyParser=require('body-parser'); // required for AJAX POST
var mongodb = require('mongodb'); // mongodb package for node
var mc = mongodb.MongoClient;
var url='mongodb://localhost:27017/test';

// connecting to the mongo db server
mc.connect(url,function(err,db){
	if(!err){
		console.log("Connected!");
	}
	collection=db.collection('sample');
});

app.set('port',5000);

app.use(express.static(__dirname+'/public')); // directory for all css and js
app.use('/favicon.ico', express.static('images/favicon.ico'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));

app.set('views',__dirname+'/views'); // directory for all ejs files
app.set('view engine','ejs'); // using .ejs instead of .html

app.get('/ledger/login',function(req,res){
	console.log("GET /ledger/login")
	res.render("login.ejs")
})
// GET /ledger
app.get('/ledger',function(request,response){
	console.log("GET /ledger")
	response.render("ledger_home.ejs");
});

// POST /ledger (called when the button is clicked)
app.post('/ledger',function(request,response){
	console.log("POST /ledger")
	var test=request.body;
	collection.insert({"id":1,"name":test['msg']});
	console.log("Inserted!");
	collection.find({}).toArray(function(err, docs) {
    	console.log("Found the following records");
    	// Printing all the documents in the sample in a nested JSON format
    	console.dir(docs);
    	// Sending back the third JSON document
    	response.send(docs[2]);
  	});
});

app.get('/ledger/react-check',function(req,res){
	console.log("GET /ledger/react-check");
	res.end("Working...");
});

// Listening on 127.0.0.1:5000
app.listen(app.get('port'),function(){
	console.log("Node app is running on localhost:",app.get('port'));
});
{'fraction_non_alphanumeric': 0.19455473624503686, 'fraction_numerical': 0.01191151446398185, 'mean_word_length': 5.112651646447141, 'pattern_counts': {'":': 4, '<': 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': '386390', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1154, 'n_words': 245}