I want to have a route in NancyFX match an jpg path, regardless of the number of path segments. For example, it should match all of:
Is this possible? It seems all the wildcard options I find for NancyFX are for a particular path segment and do not allow multiple segments (where a segment is a portion separated by '/').
It seems like it should be possible, as the static content server would need to be able to do this.
Nancy supports regular expressions in routes. You can use a regular expression to match all the routes to .jpg
images, and capture the path and name of the images:
public MyModule : NancyModule
{
public MyModule()
{
Get[@"(?<imagepath>.*)/(?<imagename>.*.jpg)"] =
params =>
{
string path = params.imagepath;
string name = params.imagename;
return DoStuff(path, name);
}
}
}