We’ll start from my previous post with a single console application with a self-hosted OWIN instance.
The goal here is to provide a routing system so that we can route our application in different section. I could use something like WebAPI but the routing and the application itself are tightly linked.
I’m going to use a nice tool called Superscribe that allow to do routing. It’s Graph based routing but it should be simple enough for us to hook it up and create routes.
Well, we’ll open up the Package Manager Console again and run the following command:
This should install all the proper dependencies to have our routing going.
Modifying our Startup.cs to include Superscribe
First thing first, let’s get rid of this silly WelcomePage we created in the previous post. Boom. Gone.
Let’s create some basic structure to handle our routes.
So this code basically create all the necessary plumbing for Superscribe to handle our requests.
So we now have a route engine to work with. So let’s first create a handler for the default “/” URL.
We’ll also create a route for “/welcome” to use our default WelcomePage that we had earlier (just for demo purpose).
We’ll also create a route for “/Home” that will return a plain text (for the moment).
Here’s what it looks like:
That was simple.
Basically, we build a simple pipeline to an OWIN middleware.
What about NancyFX with Superscribe after?