Open szabgab opened 7 years ago
There is now a module https://github.com/Bailador/bailador.net/blob/main/lib/BailadorGradual.pm in bailador.net that serves this purpose, but must be loaded at the end of the file, just before we call baile() or it will preempt all the other routes. The nice way to use this should be:
use v6;
use Bailador;
use Bailador::Gradual;
baile()
or even
use v6;
use Bailador::Gradual;
baile()
See e532a64
I think we should move it into Bailador::Feature::Gradual
In order to use it we can do:
use v6.c;
use Bailador;
use-feature('Gradual');
....
baile()
Go for it. Though as I mentioned elsewhere, currently I think it might be nice to have this out of the box without writing anything. In any case moving to Bailador::Feature::Gradual
would be a good step.
I wonder if this is possible:
A user creates a file
app.pl
withThat, without any additional configuration, will map any 'nice' URL to the corresponding .html file in the views/ directory So the user can created views/index.html and it will be served by the route / and the user can create about.html and it will be served by the route /about. The html files will be served by calling
template()
If the requested route does not have a corresponding .html file Bailador will automaticly try to serve it from the public/ directory as a static file. (css, js, ico, tx, images etc.) If no such file either then 404Then if the user wants to be more dynamic she can change the html files to include other template files (eg. header, footer) and have parameters in them as well.
If the user wants more control she can start to add routes to the
app.pl
that will work as expected.I am not sure if either of these are needed, but the static file serving can be turned off with some configuration parameter. Also the automatic route to html mapping can be turned off by a configuration parameter.
My, not yet successful attempt to implement something like this in a bailador file looks like this: