Files
compiled.world/bin/compiled.world.psgi
2026-08-22 23:59:41 -06:00

56 lines
1.1 KiB
Perl

#!/usr/bin/env perl
use 5.036;
use strict;
use warnings;
use DDP;
use Plack::Builder;
use Plack::Session::Store::DBI;
use DBIx::Connector;
use HTML::Composer;
use FindBin;
use utf8::all;
use lib "$FindBin::Bin/../lib";
use CW;
use CW::Config;
use CW::Router;
use CW::Migration;
my $h = HTML::Composer->new();
my $conf = CW::Config->new;
my $db_conf = $conf->get('db');
my $conn = DBIx::Connector->new(
$db_conf->get('dsn'),
$db_conf->get('username'),
$db_conf->get('password')
);
CW::Migration->migrate( $conn->dbh );
my $router = CW::Router->new();
$router->get('/')->action('Index#index');
$router->get('/{board}')->action('Board#index');
builder {
enable 'Session', store => Plack::Session::Store::DBI->new(
get_dbh => sub {
return $conn->dbh;
}
);
enable 'Static', path => sub {
/^\/robots\.txt/ or /^\/static\//;
},
root => "./public";
CW->new(
dbh => $conn->dbh,
environment => $conf->get('environment'),
h => $h,
router => $router
)->app;
};