beyond-code-github / Superscribe

A fresh take on URL routing for Web APIs
Apache License 2.0
64 stars 6 forks source link

SuperscribeModule with basic string route doesn't work #2

Closed jamesfoster closed 9 years ago

jamesfoster commented 10 years ago

Hi,

From reading the documentation, inside a module I should be able to do the following

  Get["Hello/World"] = o => "Hello World!";

However this doesn't work because it's wrapping the whole string in a ConstantNode

https://github.com/Roysvork/Superscribe/blob/ebbbb56c9fbbc2922cfe6fb60fc53d2c61cb1483/Superscribe/MethodSet.cs#L51

It would be good if the MethodSet would split by '/' and build the appropriate nodes.

I can get round this issue in be doing the following

  Get[(GraphNode)"Hello" / "World"] = o => "Hello World!";
MV10 commented 10 years ago

I'm too new to Superscribe to be sure which is preferable, but this also works:

Get["Hello" / (ConstantNode)"World"] = _ => "Howdy.";