<commit_before>const router = require('express').Router();

const scraper = require('../service/scraper');

router.get('/', (req, res, next) => {
    const packageName = req.query.package;

    if (!packageName) {
        const err = new Error('Undefined query');
        err.satus = 404;
        next(err);
    }

    scraper
        .scan(packageName)
        .then(result => {
            const changes = result.changes;
            res.json({ packageName, changes });
        })
        .catch(error => {
            const err = new Error('Could not request info');
            err.status = 404;
            next(err);
        });
});
<commit_msg>Change package query from query param to path variable<commit_after>const router = require('express').Router();

const scraper = require('../service/scraper');

router.get('/:package/latest', (req, res, next) => {
    const packageName = req.params.package;

    if (!packageName) {
        const err = new Error('Undefined query');
        err.satus = 404;
        next(err);
    }

    scraper
        .scan(packageName)
        .then(result => {
            const changes = result.changes;
            res.json({ packageName, changes });
        })
        .catch(error => {
            const err = new Error('Could not request info');
            err.status = 404;
            next(err);
        });
});

{'fraction_non_alphanumeric': 0.14716703458425312, 'fraction_numerical': 0.008830022075055188, 'mean_word_length': 1.9824561403508771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5595428', 'n_tokens_mistral': 393, 'n_tokens_neox': 378, 'n_words': 94}