withastro / roadmap

Ideas, suggestions, and formal RFC proposals for the Astro project.
290 stars 29 forks source link

Rerouting #896

Closed ematipico closed 3 months ago

ematipico commented 4 months ago

Summary

Programmatic control over routing.

Background & Motivation

As astro grows in popularity, it is being used for more and more use cases. One of these is multitenant websites where a tenant may be given a subdomain. This proposal introduces a powerful primitive that allows astro users to build websites with complex routing requirements. Rather than a limitation, file-based routing is now a sensible default!

Goals

Non-Goals

cdtut commented 4 months ago

Framework designed error pages

Should be possible to set in any way using an API not file based routing. Example Astro.set404Page(({ props, context }) => Astro.render("ErrorPage.astro", { props, context }))) to make 404 page. props is for SSG and SSR and context for only SSR.

Separate templating

Function like Astro.render("Page.astro", { props, context })) to output html anywhere even outside astro. You could use astro templates in other frameworks like express and use other templating engines in astro just like any SSR framework.

Pluggable router

Hono framework offer different routers https://hono.dev/concepts/routers for full speed and flexibility.

florian-lefebvre commented 3 months ago

Stage 3 RFC available in #901