Skip to content
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

Rerouting #896

Open
ematipico opened this issue Apr 16, 2024 · 1 comment
Open

Rerouting #896

ematipico opened this issue Apr 16, 2024 · 1 comment

Comments

@ematipico
Copy link
Member

ematipico commented Apr 16, 2024

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

  • Defuse.
  • Make it unnecessary to rely on implicit routing rules
  • Introduce framework-designed 404 and 500 pages
  • Make middleware run for requests that don't match a route (with framework-designed error pages)

Non-Goals

  • Reroute to an external service.
  • Support for functionPerRoute
@cdtut
Copy link

cdtut commented Apr 16, 2024

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.

@ematipico ematipico mentioned this issue Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Stage 3: Accepted Proposals, Has RFC
Development

No branches or pull requests

2 participants