Nancy, ASP.Net vNext, OSX and Sublime Text

One of the great things that ASP.Net vNext is bringing is the ability to use it cross platform with Microsoft actively testing their libraries against Mono. Along with this MS are developing a web server that is cross platform and goes by the name of Kestrel. One thing they aren't doing, yet, is making Visual Studio cross platform so we need something to write our code in. There a few editors out there but one of the most common is Sublime Text. This gives you syntax highlighting and build systems that can all be configured so if you are not aware of it check it out. Obviously before we can start writing code on OSX with our editor we need Mono installed.

UPDATE - As of August 13th 2014 there is a Mono 3.6 release which means you no longer need to compile Mono but you will need to install Homebrew for ASP.Net vNext. Skip to nnext section

At the time of writing the official binary for Mono is 3.4.0 and this does not include some features needed for ASP.Net vNext to run so we are going to have to manually compile Mono ourselves. Now I know this sounds scary but its not as bad as it seems and I've gone through the pain of setting it up so hopefully this blog post should make it easier for you

There is a guide on Mono's website on how to compile but I found some issues with it. I'm running on OSX Mavericks so I'm not sure if that resulted in issues but here's my guide to get it compiling.


Nancy, ASP.Net vNext, VS2014 & Azure

By now we know of Microsoft's plans for the next version of ASP.Net and they've turned it on its head and from the looks of it, its goooooood!

Here is a blog post from Scott Hanselman introducing ASP.Net vNext. There are introductory and deep dive videos available for your perusal which are also well worth a watch.

The TL;DR is ASP.Net vNext will take heavy influence from Node.js by using Owin to wire up all the app dependencies and middleware. It will also remove *.csproj files and use a project.json file similar to Node's package.json and use NuGet to reference the application's dependencies. It also takes inspiration from Node and Nancy's approach requiring you to opt-in to dependencies rather that traditionally having everything but the kitchen sink. It also takes influence from Nancy via built in dependency injection and Mono support. Microsoft announced they will run all their vNext tests against Mono builds ensuring all their code is compatible for cross platform deployments.

Here's a tweet direct from the horses mouth albeit with a typo .

vNext influenced by Node/Nancy


Modifying the bash prompt and adding Git completion to terminal

At work we use Git and I use Console2 to control my terminal envrionments eg/Git Bash, Powershell, Dos and when using Git I can type part type a git command press tab and it will auto complete the command or offer suggestions to commands. By default on OSX this behaviour is not present and it frustrated me enough to go and find out how to enable that behaviour.

Fire up your terminal and type in this command:

curl -o ~/.git-completion.bash

This will download a git completion file into your home folder to a hidden file called git-completion.bash.

If the file ~/.bash_profile does not already exist create it with the following command.

touch ~/.bash_profile

Now open it and paste this in:

if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash; fi

Now if you type a git command and press tab, BOOM!, you have auto complete for Git!


Introducing Owin.StatelessAuth with Nancy/Angular demo

If you're writing an API, current thinking is to provide a token in the Authorization header for your app to validate when the request comes in. I have used the Nancy.Authentication.Stateless package in the past for my APIs and even have a demo of it here if you're interested (there are more Nancy demos at This is a great package and does a great job but what if one day you want to use SignalR v2 that uses OWIN and you want to validate not just requests to your Nancy app but also the SignalR requests? You're going to need to validate requests as they come in before they get to SignalR or Nancy.

For those of you who are not quite up to date or unsure what OWIN is let me try and give you the tl:dr, no doubt others may say its something slightly different. Imagine you are asked to create a ASP.Net MVC 3 app (ignore the fact that that person needs a slap) so you fire up Visual Studio and create the app. So what has it done? Its created an app that runs on IIS and all requests come straight into your app.


Using NodeJS and FTP with Promises

I've played with node in the past but as of the new year I decided to try and make a more concerted effort to get stuck into node properly. I decided to go back to the beginning to try and get a better appreciation for the language so read "JavaScript: The Good Parts by Douglas Crockford". I found that exercise fulfilling and resulted in a few light bulb moments that made some dots join up so I'd recommend reading it if you haven't already.

Real World App

As I stated earlier I have already played with node in the past using Express and have read quite a bit on node and read many examples but I wanted to write a non-web app as I felt this would give me a better opportunity to get to grips with the language and Node. Using Express allows you to get up and running very quickly without to much head scratching so I felt a standalone script would give me more exposure to things.