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

Server Routes w/ params #18748

Open
2 of 4 tasks
joshistoast opened this issue Feb 3, 2023 · 4 comments
Open
2 of 4 tasks

Server Routes w/ params #18748

joshistoast opened this issue Feb 3, 2023 · 4 comments

Comments

@joshistoast
Copy link

joshistoast commented Feb 3, 2023

Describe the feature

I'd like to be able to create server routes where params can be passed, my particular use case is to paginate a server-generated sitemap

server/
  routes/
    sitemap_products_[page].xml.get.ts
    sitemap_collections_[page].xml.get.ts
    sitemap_pages_[page].xml.get.ts
    sitemap.xml.get.ts

I've tried the above but it results in 404 and there's no documentation on this so I assume it's a feature that hasn't been added (yet).

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@pi0
Copy link
Member

pi0 commented Feb 4, 2023

Hi. Currently, you can use something like server/routes/sitemap/products/[page].xml.get.ts for /sitemap/products/*.xml URL matcher or server/routes/sitemap/[...path].get.ts to create /sitemap/*. matcher and then handle corresponding response by parsing event.context.params.path string.

Combining static prefix or suffix string in the same dynamic segment of server route paths is not currently possible. Please follow up unjs/radix3#11

@Baroshem
Copy link
Contributor

@pi0 if there is an upstream issue of radix, can this issue be closed then? Or should we keep it as a reference? 🙂

@pi0
Copy link
Member

pi0 commented Feb 16, 2023

Let's keep it open for reference until supported :)

@manniL
Copy link
Member

manniL commented Dec 26, 2023

Related: unjs/nitro#2001

While unjs/radix3#11 is closed through unjs/radix3#52, the changes haven't been released yet for radix3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants