<commit_before>var shortid = require('shortid');
var controllers = {};

controllers.shorten = {
    description: 'Shorten',
    tags: ['shorten'],
    handler: function (request, reply) {

        var sid = shortid.generate();

        return reply(this.config.base + sid);
    }
};

module.exports = controllers;<commit_msg>first attempt at inserting new urls<commit_after>var shortid = require('shortid');
var controllers = {};

controllers.shorten = {
    description: 'Shorten',
    tags: ['shorten'],
    handler: function (request, reply) {

        var sid = shortid.generate();
        this.config.pg.query('INSERT INTO shorts ("url", "short") VALUES ( "' + request.params.url + '", "' + sid + '")', 
                             function insertError(err, result) {
                                if (err) {
                                    request.log(['error'], err);
                                };
                             });

        return reply(this.config.base + sid);
    }
};

module.exports = controllers;
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 1.9376770538243626, 'pattern_counts': {'":': 0, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6063225', 'n_tokens_mistral': 287, 'n_tokens_neox': 270, 'n_words': 63}