<commit_before>package TownCrier;

use Dancer;
use Dancer::Plugin::Auth::Basic;

use TownCrier::Model;
use TownCrier::Handler::Site;
use TownCrier::Handler::Feed;
use TownCrier::Handler::API;

my $db = TownCrier::Model->new( dsn => "dbi:SQLite:dbname=".(config->{towncrier}->{database} // "towncrier.sqlite") );

hook before => sub {
    var db => $db;
    var dbscope => $db->new_scope;
};

get "/"                          => \&TownCrier::Handler::Site::index;
get "/services/:service/?:date?" => \&TownCrier::Handler::Site::service;<commit_msg>create a new db context for each request<commit_after>package TownCrier;

use Dancer;
use Dancer::Plugin::Auth::Basic;

use TownCrier::Model;
use TownCrier::Handler::Site;
use TownCrier::Handler::Feed;
use TownCrier::Handler::API;

hook before => sub {
    my $db = TownCrier::Model->new( dsn => "dbi:SQLite:dbname=".(config->{towncrier}->{database} // "towncrier.sqlite") );
    var db => $db;
    var dbscope => $db->new_scope;
};

get "/"                          => \&TownCrier::Handler::Site::index;
get "/services/:service/?:date?" => \&TownCrier::Handler::Site::service;
{'fraction_non_alphanumeric': 0.19750889679715303, 'fraction_numerical': 0.0, 'mean_word_length': 4.487804878048781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1825429', 'n_tokens_mistral': 394, 'n_tokens_neox': 390, 'n_words': 74}