
Pete says this is something that wouldn’t be possible with tree-based routing (available in NancyFx).
(08:16) You can hook up optional nodes, which would allow things like an optional /debug/ route prefix which would hook up tracing middleware. This means you can hook up authentication middleware using an action function which will only operate on a specific node. This allows running different OWIN middleware based on route matches. (06:02) In addition to activation functions, you can also define an action function which says what should happen when a node is matched. Pete says it’s currently usable in Web API and OWIN, with NancyFx and possibly MVC on the way. (05:22) Jon asks where Superscribe can be used. (04:22) There are three guiding principles behind Superscribe: composability, efficiency and extensibility. For parameter matching, Superscribe uses TryParse rather than regex matches. You can write custom activation functions for any node. (02:37) Each node in the graph is a strongly typed entity, so you can use an activation function for each node in the graph to determine if it’s a match rather than just using a simple regex match. Extensibility due to strongly typed route nodes. (02:17) Pete explains that graph based routing is language agnostic, so there’s also a JavaScript implementation. Graph-based routing stores using a structure, so there are some performance gains due to only matching routes with a matching structure rather than using string matching. Pete explains how traditional routing needs to check each route for a match, one at a time. (00:20) Jon asks Pete to explain what Superscribe’s graph-based routing means. Note: There’s a little bit of background noise due to the conference recording. Define superscribe code#
At NDC London, Jon talks to Pete Smith about Superscribe, a library which brings graph based routing to ASP.NET, Web API and OWIN.ĭownload / Listen: Herding Code 188: Pete Smith on Superscribe ///wp-content/uploads/HerdingCode-0188-Pete-Smith.mp3