<commit_before>var express = require('express');
var app = express();
var markdown = require( "markdown" ).markdown;
var fs = require('fs');

app.get('/:slug', function(req, res){
    var fileName = 'pages/' + req.params.slug + '.md';
    fs.readFile(fileName, 'utf8', function (err, data) {
        if (err) {
            return res.status(404).send('404 - Page not found');
        }
        return res.send(markdown.toHTML(data));
    });
});

var server = app.listen(3000, function() {
    console.log('Listening on port %d', server.address().port);
});<commit_msg>refactored handler into named function<commit_after>var express = require('express');
var app = express();
var markdown = require( "markdown" ).markdown;
var fs = require('fs');

var showPage = function(req, res){
    var fileName = 'pages/' + req.params.slug + '.md';
    fs.readFile(fileName, 'utf8', function (err, data) {
        if (err) {
            return res.status(404).send('404 - Page not found');
        }
        return res.send(markdown.toHTML(data));
    });
}

app.get('/:slug', showPage);


var server = app.listen(3000, function() {
    console.log('Listening on port %d', server.address().port);
});
{'fraction_non_alphanumeric': 0.1825063078216989, 'fraction_numerical': 0.018502943650126155, 'mean_word_length': 3.358974358974359, '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': '3757841', 'n_tokens_mistral': 389, 'n_tokens_neox': 375, 'n_words': 97}