First of all, welcome to Nancy! Our main inspiration is the Sinatra framework for Ruby and, hence, Nancy was named after the daughter of Frank Sinatra :) Many people wonder what Fx in NancyFx means so here it is (drum roll); it just means framework! NancyFx is the name of the umbrella project that contains all the components.
These guides will give you a quick tour of some of the features in Nancy without diving into too many details. There will be more to things than meets the eye so we invite you to explore Nancy on your own as well!
Nancy is a lightweight, low-ceremony, framework for building HTTP based services on .NET and Mono. The goal of the framework is to stay out of the way as much as possible and provide a super-duper-happy-path to all interactions.
This means that everything in Nancy is setup to have sensible defaults and conventions, instead of making you jump through hoops and go through configuration hell just to get up and running. With Nancy you can go from zero to website in a matter of minutes. Literally.
Nancy is designed to handle DELETE
, GET
, HEAD
, OPTIONS
, POST
, PUT
and PATCH
requests and provides a simple, elegant, Domain Specific Language (DSL) for returning a response with just a couple of keystrokes, leaving you with more time to focus on the important bits.. your code and your application.
All of this is built, by the community, as an open-source framework, meaning you get full access to the source code, and is licensed under the MIT license.
You can get Nancy from Nuget, our TeamCity server (for latest builds) or download the source from our GitHub repositories.
Nancy is built to run anywhere and we mean it. Right from the start, Nancy was designed to not have any dependencies on existing frameworks. Built with the .NET framework client profile, Nancy can be used pretty much wherever you want to, since it’s completely self contained with its own request and response objects.
One of the core concepts in Nancy is hosts. A host acts as an adaptor for a hosting environment and Nancy, thus enabling Nancy to run on existing technologies such as ASP.NET, WCF and OWIN, or integrated in any given application.
Specific host implementations are not shipped with the core Nancy framework. They are shipped separately, as are many other additional functionalities such as forms authentication, from the sources mentioned earlier. Building a Nancy application is like picking your favourite parts from a web framework buffet! Usually the bare minimum you will use when building a Nancy service are the core framework and a host.
The super-duper-happy-pathThe “super-duper-happy-path” (or SDHP if you’re ‘down with the kids’ 😉) is a phrase we coined to describe the ethos of Nancy; and providing the “super-duper-happy-path” experience is something we strive for in all of our APIs.
While it’s hard to pin down exactly what it is, it’s a very emotive term after all, but the basic ideas behind it are:
Above all, creating an application with Nancy should be a pleasure, and hopefully fun! But without sacrificing the power or extensibility that you may need as your application grows.
Creating your first Nancy applicationEnough talk, let’s see some code! We are going to assume that you have Nuget installed and are using Visual Studio 2010, however, this works equally as well on Mono (using version 2.10.2 or later) and MonoDevelop. We’re going to build the ubiquitous “hello world” application using Nancy and Nancy’s ASP.NET hosting.
Nancy empty project with ASP.NET host
if using SideWaffle. Create a new Nancy Empty Web Application with ASP.NET Hosting
if using the Nancy Project templates.Nancy module
, which is a standard C# class, and define a route handler for the root URL of the web application, by adding a small amount of code to the constructor:The HelloModule.cs code
public class HelloModule : NancyModule { public HelloModule() { Get["/"] = parameters => "Hello World"; } }
It is important that you declare your module public, otherwise NancyFx is not able to discover your module.
Documentation overview — Part 2. Exploring the Nancy module »
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4