The "Instant Nancy Web Development" Book

After a quick six month writing and editing process my Nancy book is published. It's available as e-pub, mobi, pfd and dead trees via the publishers site as well as Amazon, Amazon UK, and Safari.

What's it about?
Well, it about the Nancy web framework. Nancy is an awesome .NET based web framework that focuses on being both easy and fun to work with. Nancy lends itself to writing highly testable web application with simple, concise and readable code. Who doesn't want that?
The book starts from the very basics of getting Nancy up and running, but quickly moves into more interesting areas including dependency injection, hosting, content negotiation, authentication, async processing and more.

Read more...

Async Route Handling with Nancy

I don't know about you but all I hear is "ASYNC ALL THE THINGS!", I think this is partly down to its new and shiny and us developers love "the shiny" and partly a lot of the things we do in our applications are I/O based whether that be database or file system.

The problem that comes with the new and shiny bandwagon is you need to understand what you're evangelising. Making asynchronous methods and executing them with no actual reason will not give your codebase any gains and could actually effect your application's performance. There is more depth to that argument but for simplicity just remember this, only use asynchronous methods if you are doing some sort of I/O.

It could also be

Read more...

Getting RavenDB Profiling Working on Nancy

This is my second attempt. :)

About a year ago I made an attempt to wire Nancy together with RavenDB and failed miserably. Needed a break from businessy coding last night so I decided to work on something fun instead.

The ability to see what's going on in your application is so important when it comes to performance tuning. Yes, there's that old adage about premature optimization. IMO this phrase is taken out of context. To me 97% of the time means 97% of the code in your face, which is doing stuff in memory. The other 3% of your code is doing I/O of some sort. Minimizing the use of I/O will provide the biggest performance gains for most applications.

In fact having the profiler on here

Read more...

My Nancy Talk from NDC

The video of the talk I did on Nancy at NDC is out.

The talk me writing some Nancy code, talking a lot about Nancy and at the end I have a simple todo application.

Enjoy!


Read more...

Lowering The Barrier To Entry For Testing On Linux / Mono With Vagrant

Introduction We are big fans of Mono on the Nancy project – we have Continuous Integration builds that run on both Mono 2.x, and Mono 3.x (in addition to Microsoft’s .net), and we have TravisCI also performing Mono builds of all pull requests as they come in. As good as Mono is though, there are […]

Read more...

Windows 8, Hyper-V, VirtualBox, Vagrant and Hanging on Boot

 Introduction I’ve recently been playing around with Vagrant to allow Nancy contributors to easily test their changes on Mono, even if they don’t have much (or any) experience with Linux or Mono itself (more on this soon). Vagrant allows scripts to be created to quickly and easily spin up virtuals with a certain configuration, and just […]

Read more...

Automatic Exception Reporting with YouTrack and Nancy pt. 2: Bouncing Off the Green Monster

In Part 1 of this series we looked at putting NancyFX as a simple http wrapper in front of YouTrack. Now we're going to make it more RESTful - i.e. we will display the error page to the user agent and include the exception report form on that page.

We will do this by leveraging Nancy's status code handling features. This will allow us to intercept any status code we want and modify the response. Let's start with the view to collect the bug report:

@inherits NancyRazorViewBase<Nancy.Extras.ExceptionReporting.ViewModels.ReportExceptionViewModel>
<!DOCTYPE html>
<html>
<!-- Views/50x.cshtml -->
<head>

Read more...

Automatic Exception Reporting with YouTrack and Nancy pt. 1: The Skeleton

Getting the business users to try and recreate a bug is difficult to say the least. They may not remember what it is they did to reproduce. But you can bet that if you don't fix it by yesterday you're gonna get an earful. In fact we just did. This is me doing something about it :)

Turns out this is annoyingly easy with Nancy and the YouTrackSharp library, so easy that I'm not going to bother test driving this. Frankly writing this post took longer than the actual code. First, the Bootstrapper:

public class Bootstrapper : DefaultNancyBootstrapper
{
    protected override void ConfigureApplicationContainer(TinyIoc.TinyIoCContainer container)
    {

Read more...

Empty Project - Nancy vs MVC4

I just installed the Nancy.Templates for Visual Studio. Before this, creating a project for Nancy has always been a bit of a pain - adding a mvc project and then removing a whole bunch of crap you don't need. Way too much fiddlery required.

What really got me was the minimalistic set of dependencies:

Nancy FTW
Nine is a good number.

Compare that to an empty MVC4 project:

Imgur
Seventeen is very inauspicious.

A Nancy.Hosting.SelfHost project would have even less dependencies. I think this is the key to true RAD - less cruft to get in your way.

Read more...

Mocking HttpContext with Fake It Easy

Lets start with the conclusion first and say “use Nancy for your web applications and APIs” as its brilliant!

If you want to continue reading lets crack on.

I’m currently working on a ASP.Net MVC project and one of the controller methods writes directly to the Response, eg. Response.Write(“How will I mock thee?”);

Having moved over to xUnit and FakeItEasy recently I wanted to write a unit or integration test depending how you see it to assert against the Http Response.

Doing this is no easy feat with MVC (with Nancy its all done for you) and you have to mock a lot of things. I’m hoping that in later releases this will be fixed because I know that ASP.Net Web API has made things a bit

Read more...