<commit_before>'use strict';
var middleware  = require('../middleware');
var Router      = require('express').Router();

Router.route('/version')
    .get(middleware.authenticate('user', 'guest'))
    .get(function(req, res) {
        var version = process.env.VERSION || 'unknown';
        version = '{"version":"'+version+'"}'
        return res.json(200, JSON.parse(version));
    });
module.exports = Router;<commit_msg>Image version query handled via API<commit_after>var middleware  = require('../middleware');
var Router      = require('express').Router();

const IMG_URL = process.env.IMG_URL || 'http://localhost:9003';

Router.route('/version/api')
    .get(middleware.authenticate('user', 'guest'))
    .get(function(req, res) {
        var version = process.env.VERSION || 'unknown';
        version = '{"version":"'+version+'"}'
        return res.json(200, JSON.parse(version));
    });

Router.route('/version/img')
    .get(middleware.authenticate('user', 'guest'))
    .get(function(req, ress) {
        var version = '{"version":"unknown"}';
        request.get(IMG_URL+'/version')
            .end(function(err, res){
                version = '{"version":"'+res.body.version+'"}';
                return ress.json(200, JSON.parse(version));
            });
    });

module.exports = Router;
{'fraction_non_alphanumeric': 0.1946564885496183, 'fraction_numerical': 0.009923664122137405, 'mean_word_length': 3.201923076923077, 'pattern_counts': {'":': 4, '<': 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': '2049552', 'n_tokens_mistral': 409, 'n_tokens_neox': 397, 'n_words': 70}