<commit_before>module.exports = function(app, settings) {
    app.get('/status.json', function(req, res) {
        res.send({ status: 'true' });
    });

    /**
     * @TODO expose available fonts (and other 'abilities').
     */
    app.get('/abilities.json', function(req, res) {
        res.send({ fonts: [] });
    });

    /**
     * Inspect fields
     */
    app.get('/:mapfile_64/fields.json', function(req, res) {
        res.send({});
    });

    /**
     * Inspect data
     */
    app.get('/:mapfile_64/data.json', function(req, res) {
        res.send({});
    });

    /**
     * Inspect layer
     */
    app.get('/:mapfile_64/:layer_64/layer.json', function(req, res) {
        res.send({});
    });

    /**
     * Inspect field values
     */
    app.get('/:mapfile_64/:layer_64/:feature_64/values.json', function(req, res) {
        res.send({});
    });
}
<commit_msg>Add skeleton route middleware loaders for inspection callbacks.<commit_after>module.exports = function(app, settings) {
    /**
     * Map loader, express route middleware.
     */
    function loadMap(req, res, next) {
        if (req.param('mapfile_64')) {
            var Map = require('tilelive.js').Map;
            var map = new Map(req.param('mapfile_64'), settings.mapfile_dir, true);
            map.localize(function() {
                res.map = map.mapnik_map();
                next();
            });
        }
        else {
            next(new Error('Map could not be loaded.'));
        }
    }

    /**
     * @TODO: Implement once node-mapnik exposes layers.
     * Layer loader, express route middleware.
     */
    function loadLayer(req, res, next) {
        if (req.param('layer_64')) {
            next();
        }
        else {
            next(new Error('Layer could not be loaded.'));
        }
    }

    /**
     * @TODO: Implement once node-mapnik exposes layers.
     * Feature loader, express route middleware.
     */
    function loadFeature(req, res, next) {
        if (req.param('feature_64')) {
            next();
        }
        else {
            next(new Error('Feature could not be loaded.'));
        }
    }

    app.get('/status.json', function(req, res) {
        res.send({ status: 'true' });
    });

    /**
     * @TODO expose available fonts (and other 'abilities').
     */
    app.get('/abilities.json', function(req, res) {
        res.send({ fonts: [] });
    });

    /**
     * Inspect fields
     */
    app.get('/:mapfile_64/fields.json', loadMap, function(req, res, next) {
        res.send({});
    });

    /**
     * Inspect data
     */
    app.get('/:mapfile_64/data.json', loadMap, function(req, res, next) {
        res.send({});
    });

    /**
     * Inspect layer
     */
    app.get('/:mapfile_64/:layer_64/layer.json', loadMap, loadLayer, function(req, res, next) {
        res.send({});
    });

    /**
     * Inspect field values
     */
    app.get('/:mapfile_64/:layer_64/:feature_64/values.json', loadMap, loadLayer, loadFeature, function(req, res, next) {
        res.send({});
    });
}

{'fraction_non_alphanumeric': 0.17487765089722676, 'fraction_numerical': 0.011745513866231648, 'mean_word_length': 1.887005649717514, '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': '5160275', 'n_tokens_mistral': 998, 'n_tokens_neox': 964, 'n_words': 191}