<commit_before>var Database = require('./db');
var db = new Database();

module.exports = function (req, res) {
    var errorHandle = function () {
        res.code = '4.00';
        res.end(JSON.stringify({method: 'not support'}));
    };

    var uriQuery = [];
    var existBlock = false;
    for (var i = 1; i < req.options.length; i++) {
        if (req.options[i].name === 'Uri-Query') {
            uriQuery.push(req.options[i].value.toString());
            existBlock = true;
        }
    }
    if (!existBlock) {
        return errorHandle();
    }

    var handlerGet = function () {
        var payload = {user: 1, device: 1};
        db.findOrder(payload, 1, function (dbResult) {
            console.log(dbResult);
            res.code = '2.05';
            res.end(JSON.stringify({result: dbResult}));<commit_msg>add result handle<commit_after>var Database = require('./db');
var db = new Database();

module.exports = function (req, res) {
    var errorHandle = function () {
        res.code = '4.00';
        res.end(JSON.stringify({method: 'not support'}));
    };

    var uriQuery = {};
    var existBlock = false;
    for (var i = 0; i < req.options.length; i++) {
        if (req.options[i].name === 'Uri-Query') {
            var query = req.options[i].value.toString().split(':');
            uriQuery[query[0]] = parseInt(query[1]);
            existBlock = true;
        }
    }
    if (!existBlock) {
        return errorHandle();
    }

    var handlerGet = function () {
        var payload = {user: uriQuery.user, device: uriQuery.device};
        db.find(payload, function (dbResult) {
            res.code = '2.05';
            res.end(JSON.stringify({result: dbResult}));
{'fraction_non_alphanumeric': 0.16588511137162953, 'fraction_numerical': 0.011137162954279016, 'mean_word_length': 2.196629213483146, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2235717', 'n_tokens_mistral': 530, 'n_tokens_neox': 519, 'n_words': 121}