Search code examples
nancy

Routing in NancyFX


A sample route in Nancy can be like:

Get["/method/key1={value1}/key2={value2}"]

which can be reached by calling it as:

/method/key1=foo/key2=bar

I want to write the querystring in below manner:

method?key1=value1&key2=value2

What would be the route for this?


Solution

  • It will be the following route:

    GET["/method"] => x
    {
       var key1 = Request.Query.key1;
       var key2 = Request.Query.key2;
    };
    

    Where Query is DynamicDictionary.

    Related Questions: