Hi everyone,
I took the Yancy app example from the Mojolicious Advent calendar and made
some minor modifications to use an SQLite backend instead of Postgres.
Thing is, the page won't render at all , but there is no error message.
>From my understanding of the purpose of this plugin, it should render blank
at least ? (no posts, for instance)
Any idea what I'm doing wrong ? Below is the full code.
Best regards,
use Mojolicious::Lite;
use Mojo::SQLite;
my $sql = Mojo::SQLite->new('sqlite:config.db');
# Use migrations to create a table
$sql->migrations->name('my_config_app')->from_string(migrations->migrate(0)->migrate;
plugin Yancy => {
backend => 'sqlite:config.db',
collections => {
hosts => {
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(
'hosts',
) ],
);
};
app->start;
__DATA__
@@ index.html.ep
Hello, world!
https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css";
integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb"
crossorigin="anonymous">
% for my $post ( @{ stash 'posts' } ) {
<%== $post->{html} %>
% }
https://code.jquery.com/jquery-3.2.1.slim.min.js";
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous">
https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js";
integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh"
crossorigin="anonymous">
https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js";
integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ"
crossorigin="anonymous">
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.