<commit_before>var express = require('express');
var app = express();

function logDebug(message) {
	if(process.env.npm_package_config_debugInfo) {
		console.log(message);
	}
}

app.set('views', 'Jade Pages');
app.set('view engine', 'jade');

app.get('/', function(req, res) {
	res.render('index', {
		'name': 'Joe'
	});
});

app.get('/motionDetected/', function(req, res) {
        var clientID = req.query.client;
        var motion = req.query.motion;
        if(clientID !== undefined && motion !== undefined) {
                res.send("Success!");
                logDebug("Got client " + clientID + " who saw motion!");
        } else {
                res.send("No parameters!");
                logDebug("Client sent potential motion but no parameters were found.");
        }
});
<commit_msg>Base use of sqlite for storeage<commit_after>var express = require('express');
var app = express();

var fs = require("fs");
var file = "motionevenlog.db";
var exists = fs.existsSync(file);
var sqlite3 = require("sqlite3").verbose();

function logDebug(message) {
        if(process.env.npm_package_config_debugInfo) {
                console.log(message);
        }
}
function dbStoreEvent(sensorid, time){
        var db = new sqlite3.Database(file);
        db.serialize(function(){
                if(!exists){
                        db.run("CREATE TABLE events (sensorid TEXT, time TEXT)");
                }
                var statement = db.prepare("INSERT INTO events VALUES (?,?)");
                statement.run(sensorid, time);
                statement.finalize();
                });
        });
        db.close();
}
function dbRetrieveEvents(){
        var db = new sqlite3.Database(file);
        var returned;
        db.serialize(function(){
                db.each("SELECT rowid AS id, sensorid, time FROM events", function(err, row){
                //console.log(row.id + ": " + row.sensorid + row.time);
                returned = row.id + ": " + row.sensorid + " " + row.time;
        });
        db.close();
        return returned;
}

app.set('views', 'Jade Pages');
app.set('view engine', 'jade');

app.get('/', function(req, res) {
        res.render('index', {
                'name': 'Joe'
        });
});

app.get('/motionDetected/', function(req, res) {
        var clientID = req.query.client;
        var motion = req.query.motion;
        if(clientID !== undefined && motion !== undefined) {
                res.send("Success!");
                logDebug("Got client " + clientID + " who saw motion!");
        } else {
                res.send("No parameters!");
                logDebug("Client sent potential motion but no parameters were found.");
        }
});

{'fraction_non_alphanumeric': 0.15680473372781065, 'fraction_numerical': 0.0014792899408284023, 'mean_word_length': 2.1637426900584797, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6750274', 'n_tokens_mistral': 795, 'n_tokens_neox': 753, 'n_words': 180}