"Microservices in .NET Core" has landed

My new book "Microservices in .NET Core  - with examples in Nancy" has been published. It's been available as an early access ebook for a long time, but now the final paper book and the final ebook is available.


This book is very much based on experience from working of real microservices systems. While the examples in the book are not lifted directly from any particular system they are inspired by real world systems. My rule has been that all the examples demonstrate something that could have been in one or more of the systems I have experience with.

With this book I have tried to show two things:

    1. How to design a microservices system.
    2. How to build such a

Read more...

VQ Communications Funds NancyFX to run on CoreCLR

Nearly 2 years ago I was employed by VQ Communications primarily because of my open source contributions to NancyFX. They had started work on a v2 of their flagship product and had begun work with Nancy and needed someone to help drive a HTTP API and architect a scaling solution as their v2 product was addressing a requirement they had for it cope with large volumes of traffic. Also of interest to me was their aim to deliver all of this as a black box appliance to customers on a VM running a custom embedded version of Linux using Postgres as the database. I would work four days a week remotely and go into the office one day a week. They already had completely remote employees and since

Read more...

9x Your Nancyfx Boot Time With This One Simple Trick

I've always wanted to write a click bait headline and it seems like I've now found the perfect opportunity.

I run my side project, CompareVino, on the "Canoe" Appharbor plan - cheap and cheerful but it gets the job done. My only gripe was that NancyFX would take between 4

Read more...

Introducing Negotiator - a GoLang content negotiation library

In my continued experience learning GoLang I started looking at how to best use it when dealing with HTTP. The idiomatic way to use GoLang and HTTP is to use the standard library which keeps things minimal but there are a few features missing. The first thing is a router. OOTB GoLang doesn't have a router and the majority seem to suggest using a package called Mux from Gorilla Toolkit, a set of libraries that aims to improve the standard library from Go. After having a play with it I didn't really warm to it so spent some time looking into the alternatives (and there are plenty!) and eventually decided upon Goji

Once I had started using Goji I then wanted to handle content negotiation

Read more...

NancyFX and Hypermedia

I've been slowly educating my self on hypermedia; what it is, how does it help and how to use it. I must say I've found it a very interesting topic and I thought it was time I put some information into a blog post just in case the 2 people that read this blog might find it useful.

In my day job I'm responsible for a HTTP API (notice I didn't use REST) and some months ago I spoke to Glenn Block around a general discussion about hypermedia. Glenn put this on YouTube if you want to watch it.

Read more...

Cookie Authentication & CRSF with AngularJs, Owin & Mono

I'm currently working on a project that has Nancy serving up an API. For the UI there is AngularJS. We were using JWT for authentication just to get us up and running but then as things became more final in the product we knew it would be better to swap to cookies for security plus we may as well leverage the browser capabilities for cookie handling. I'm not going to get into the arguments about JWT security vs cookie security, there are advantages/disadvantages for using both in this scenario. Our API is built on top of OWIN and Microsoft provide cookie middleware so I thought this would be nice and simple to plug in. Lets just remember I'm working on Mono!

In our Startup class I

Read more...

Nancy 1.0 and the Book

In light of Nancy recently reaching 1.0 (and quickly thereafter 1.1), I thought it was appropriate to revisit my Nancy book, and the running code sample in it on Nancy 1.1. This post looks at what's changed and what I might have coded differently now.

But first,

Is the Book still Relevant?

Yes, I think the book is still relevant. Almost all the code works unchanged with Nancy 1.1, and Nancy still follows the same principals and philosophy. I still think the book is a quick way to get introduced to Nancys way of doing things, the DSLs it provides and it awesome extensibility.
(But then again, I may be slightly biased)

What Broke Between Then and Now?

After updating the Nancy packages in my copy of

Read more...

Using Nancy.Linker with Razor Views

First things first: I recommend that you use Nancy.Linker to generate link in the route handler not the view code, as described in my last post. If you insist on generating the links in the view code here is how to make Nancy.Linker work with Razor views.

Firstly you need to pass an instance on IResourceLinker and the NancyContext to your view. This works just like passing any other object from the handler to the view  - in your Nancy module you have your route handler pass the IResoureLinker and NancyContext objects as part of the model to the view you want to render:




The NancyContext must  passed along with the IResourceLinker, since Nancy.Linker needs it to generate links. Once

Read more...

Permament redirect to HTTPS with IIS

Google has just recently updated their search results to give higher ranking to sites with an SSL Certificate, than to sites without, which is one of the best changes Google has made in recent years. There really is no excuse for not having a cert now. (note, this is limited to small portion of sites but lets assume that this will be rolled out if Google proves it to be worth while)

googleonlinesecurity - https-as-ranking-signal_6.html

Unfortuntely for me it seems Github Pages does not support Certificates on custom domain names, yet... :( hopefully they will support this eventually so that I can avoid moving my blog.

So one thing that pops up in the Nancy channel on JabbR

Read more...

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

Read more...