Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
gradual serving #120
I wonder if this is possible:
A user creates a file
That, 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
Then 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
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:
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: