pedronauck / micro-router

:station: A tiny and functional router for Zeit's Micro

Home Page:https://www.npmjs.com/microrouter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support passing options to `url-pattern`

kevva opened this issue · comments

I have a use case where I want to match everything after a certain path, but micro-router only lets me match certain characters, so instead I have to use a regex like this:

get(/^\/foo\/([^]*)$/, req => {
	const [match] = req.params;
	console.log(match);
	//=> whatever/requested.jpg
});

I would like to be able to name my capture groups like this and also have the ability to define the options sent to url-pattern.

In the new release you can do that passing the path argument as a UrlPattern instance

Sweet, thanks!