<commit_before>/**
 * @author daniel.joppi
 * @since 2/12/14.
 */
module.exports = function(router, db) {
    var BSON = db.bson;
    //Link routes and functions

    //GET - Return all users in the DB
    router.get('/:entity', function (req, res) {
        var entity = req.params.entity;

        db.collection(entity, function(err, collection) {
            collection.find().toArray(function(err, items) {
                if (err) {
                    console.log('ERROR: ' + err);
                    res.send({entity: entity, status: "error", msg: ""+err});
                } else {
                    console.log('GET /'+entity);
                    res.send(items);
                }
            });
        });
    });
    //GET - Return a user with specified ID
    router.get('/:entity/:id', function (req, res) {
        var entity = req.params.entity;
        var id = req.params.id;

        console.log(entity, id);
        db.collection(entity, function(err, collection) {<commit_msg>validations<commit_after>/**
 * @author daniel.joppi
 * @since 2/12/14.
 */
module.exports = function(router, db) {
    var BSON = db.bson;
    //Link routes and functions

    //GET - Return all users in the DB
    router.get('/:entity', function (req, res) {
        var entity = req.params.entity;

        db.collection(entity, function(err, collection) {
            collection.find().toArray(function(err, items) {
                if (err) {
                    console.log('ERROR: ' + err);
                    res.send({entity: entity, status: "error", msg: ""+err});
                } else {
                    console.log('GET /'+entity);
                    res.send(items);
                }
            });
        });
    });
    //GET - Return a user with specified ID
    router.get('/:entity/:id', function (req, res) {
        var entity = req.params.entity;
        var id = req.params.id;

        console.log(db.collection(entity));
        db.collection(entity, function(err, collection) {
{'fraction_non_alphanumeric': 0.14789081885856079, 'fraction_numerical': 0.004962779156327543, 'mean_word_length': 1.6987951807228916, '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': '6055165', 'n_tokens_mistral': 594, 'n_tokens_neox': 569, 'n_words': 139}