question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

catch-all parameter support

See original GitHub issue

Hi! I’m curious if there’s an easy way to catch the whole URL path, including slash character.

E.g. by using single handler component:

<Route path="/:path" component={Test} />

I want to catch the whole path into the path parameter, including slash character, e.g. /project and /project/test This behavior is not handled properly by default.

For now I managed to make a dirty workaround:

<Route path="/:path" component={PageView} />
<Route path="/:path/:subpath" component={PageView} />

Do you have any hint on more proper way to achieve it?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
EmilTholincommented, May 24, 2019

Thank you for the great suggestion @aherok. The support for naming wildcards was added in 1.1.0.

<!-- App.svelte -->
<Route path="page/*wildcardName" component={Page} />

<!-- Page.svelte -->
<script>
  export let wildcardName;
</script>

<h1>{wildcardName}</h1>
1reaction
aherokcommented, May 22, 2019

Oh, I didn’t get your question.

In some other router package I’ve seen something like:

<Route path="*path" />

Which was just catching the whole path to the path parameter. Similar option here would be even better than just passing the asterisk alone as it would not require using $$props object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom catch-all parameter in routing - asp.net - Stack Overflow
A class has been written that supports this. I've written such a class that can handle catch-all segment anywhere in the URL. There's...
Read more >
Support for catch-all parameter syntax · Issue #1100 - GitHub
When sending a request via SwaggerUI, parameter bar will be escaped. In this case, all '/' will be replaced with %2F . Steps...
Read more >
Catch-All Parameters in ASP.NET Core MVC 6 - YouTube
In this video we'll learn how to define catch-all parameters for our routes. Also, we'll see how to configure a simple 404 page....
Read more >
Catch-all parameter (routing) and Request.Url.Path - MSDN
Hello Gentlemen,. I would ask you about some issues related to routing in asp.net mvc. ... As you can see I use catch-all...
Read more >
Dynamic Routes - Next.js
However, route parameters will override query parameters with the same name. ... Catch all routes can be made optional by including the parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found