<commit_before>var shortener = require('./shortener');
var redis = require('redis').createClient();

exports.index = function (req, res) {
    var context = {
        'title': "Homepage",
    };

    res.render('index', context);
};

exports.submit = function (req, res) {
    var url = req.body.url;
    var message = "success";

    console.log(url);

    shortener.shorten(url, function (url, err) {
        if (err) res.json(400, { 'message': err });

        res.json(200,{
            'message': message,
            'url': url
        });
    });
};

exports.redirect = function (req, res) {
    alias = req.params.alias;
    
    //TODO: url = getUrl(alias);
    url = "http://google.com";
    res.redirect(url);
};<commit_msg>forgot to add var<commit_after>var shortener = require('./shortener');
var redis = require('redis').createClient();

exports.index = function (req, res) {
    var context = {
        'title': "Homepage",
    };

    res.render('index', context);
};

exports.submit = function (req, res) {
    var url = req.body.url;
    var message = "success";

    console.log(url);

    redis.get('testKey', function (err,res) {
        console.log(res.toString());
    });

    console.log("reading key-value");

    shortener.shorten(url, function (url, err) {
        if (err) res.json(400, { 'message': err });

        res.json(200,{
            'message': message,
            'url': url
        });
    });
};

exports.redirect = function (req, res) {
    alias = req.params.alias;
    
    //TODO: url = getUrl(alias);
    var url = "http://google.com";
    res.redirect(url);
};
{'fraction_non_alphanumeric': 0.18023617153511498, 'fraction_numerical': 0.0074580484773151025, 'mean_word_length': 2.4549356223175964, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3045231', 'n_tokens_mistral': 540, 'n_tokens_neox': 518, 'n_words': 116}