is it possible to use matchFilters from @solidjs/router in file routes?
I want to subset params.id to specific values and return 404 if not in range, with normal routes I would use a matchFilter, what can I use when filerouting?
4 Replies
I'm not sure if this is the preferred approach, but you do have access to the params in the
The good news is the blow seems to work with
load
function.
So you might be able to do something like below, where I wrapped the validateFileId
in a cache
because I believe this is the only way to properly handle either returning a redirect
.
I've become used to using throw redirect
, but I was having issues with this and I'm not sure why, but returning a redirect
seems to work (maybe a recent API change, as I just created a fresh solid-start repo, and it's now v 0.6.0, as of today).The good news is the blow seems to work with
solid-start
with bother CSR and SSR.
Thanks for the tip, I was hoping to find a solution without redirect to preserve the url
is
cache
from @solidjs/router
documented somewhere? never saw it beforeGitHub
GitHub - solidjs/solid-router: A universal router for Solid inspire...
A universal router for Solid inspired by Ember and React Router - solidjs/solid-router
Thanks