-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build dynamic routes #336
Comments
Do you mean eg building only a catchall non-SSR index.html if there are dynamic routes? Or maybe build SSR-able routes like now, and for dynamic routes build a separate |
Might be an interesting solution. Defining a |
@goto-bus-stop I though on keep building everything for static routes, and a catchall for dynamic, so the 200.html would be fine. Maybe also a 404.html if there is a |
I think we have another option for serving dynamics routes. We could use a cached template and a service worker to render dynamic routes, like this // sw.js
self.addEventListener('fetch', function (event) {
var params = getParams(event.request.url, route)
event.respondWith(
caches.match('/article-template.html').then(function (response) {
return response.text()
}).then(function (responses) {
var template = responses[0]
return new Response(renderTemplate(template, params), {
headers: {
'Content-Type': 'text/html'
}
})
)
}) This would give a What do you guys think? |
@YerkoPalma ohh, as a general idea this is quite interesting! e.g. "What if we did server-rendering... on the client! - to cover cases where the client doesn't yet have a unique URL". That's definitely interesting hey. I feel there would be more than a few edge cases, but sounds like it'd make for a cool experiment to scope out which exactly those are - might turn out to be a very reasonable approach! |
As commented here this issue is to keep track of the state of dynamic routes build.
IMO this should be supported because is a basic feature of almost any app, and because previous versions of Bankai supported this. The problem is that the server side rendering for the build command is hard (for start, @Flet push some commits that support it in #310). So here is my first proposal/question, can we just disable SSR on dynamic routes, and leave that to choo?
Also my guess is that dynamic SSR requires a smart server, so could be an option that, if we detect dynamic routes, then we add a simple
server.js
file that would handle SSR on dynamic routes.The text was updated successfully, but these errors were encountered: