How to resolve relative routes
I have a sub-router like this
How can I construct a URL to pass it to the anchor in the catch-all route so that it would point to the index route above?
This router exists as a subrouter so it has no idea what route it has been assigned to.
The only solution I could come up with would involve doing a route
:total-unique-param/*
and then looking at the matched route and the request path and resolving them to a relative url.7 Replies
hope that helps me get an answer faster...
well of course I would solve it after posting this
hope someone would enjoy the meme at least...
Yup, it did attract some attention for sure
improved it a bit and turned into a more reusable middleware kinda
but i kinda wish this was a built-in
it makes sense I would want to declare relative routes which can then be resolved to the absolute ones - my router shouldnt know where and which route it was mounted to - and I should be able to just do
resolveRoute("/")
and it would give me the absolute routePlease mark this issue as solved ✅ 🙂
how?(
i've tried / but dont see the command
Good question, I thought would have some options available being the OP. 😅
@Huge Letters you should be able to right click your post and change the flair. Let me know if you can’t. I’ll also see about adding a / command