#!/usr/bin/env perl use Mojolicious::Lite; use Mojo::SQLite; helper db => sub { state $db = Mojo::SQLite->new( 'sqlite:' . app->home->child( 'docs.db' ) ); return $db; }; app->db->auto_migrate(1)->migrations->from_data(); plugin 'PODViewer', { default_module => 'Yancy', allow_modules => [qw( Yancy Mojolicious::Plugin::Yancy )], layout => 'default', }; plugin 'Yancy', { backend => { Sqlite => app->db }, read_schema => 1, schema => { pages => { 'x-id-field' => 'path', 'x-list-columns' => [qw( path )], 'x-view-item-url' => '/{path}', properties => { id => { readOnly => 1, }, markdown => { format => 'markdown', 'x-html-field' => 'html', }, }, }, }, }; get '/*id' => { id => 'index', # Default to index page controller => 'yancy', action => 'get', schema => 'pages', template => 'pages', }; # Start the app. Must be the last code of the script app->start; __DATA__ @@ layouts/default.html.ep