use Mojolicious::Lite; use Mojo::Pg; my $pg = Mojo::Pg->new( 'postgres://localhost/blog' ); $pg->migrations->from_data->migrate; plugin Yancy => { backend => 'pg://localhost/blog', schema => { blog => { required => [ 'title', 'markdown', 'html' ], properties => { id => { type => 'integer', readOnly => 1, }, title => { type => 'string', }, markdown => { type => 'string', format => 'markdown', 'x-html-field' => 'html', }, html => { type => 'string', }, }, }, }, }; get '/' => sub { my ( $c ) = @_; return $c->render( 'index', posts => [ $c->yancy->list( 'blog', {}, { order_by => { -desc => 'created' } }, ) ], ); }; app->start; __DATA__ @@ index.html.ep