Mini-Training: NancyFX


Published on

Discover in this mini-training what NancyFX is: a Lightweight Web Framework for .net

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Mini-Training: NancyFX

  1. 1. NancyFX The super-duper-happy-path
  2. 2. Overview • Designed for building HTTP based services on .NET and Mono. • Prioritise conventions over configurations • Provides an easy Domain Specific Language • Open-source under MIT license • No dependencies on existing framework • Can be used over different hosting environment (ASP.NET, WCF, …) using specific host implementations
  3. 3. • Handle DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH requests • Integrate view engines (Razor, Spark, dotLiquid, its own SuperSimpleViewEngine, and more) • Advanced routing and parameter capabilities • Easy response syntax • Embark its own testing framework • Model binding 3 Features
  4. 4. The super-what ? • This is the ethos the team is striving for, but here are the basic ideas behind it : – It just works – little to no configuration even when adding modules, viewengines, dependencies, etc. – Easily customisable – possibility to redefine each pieces of the frameworks – Low ceremony – minimal amount of « Nancy code », focus is on the application code – Low friction – easy usage of the framework without sacrificing extensibility and power when you need it
  5. 5. • Define the behavior of your application • Must inherit NancyModule and are globally discovered 5 Modules
  6. 6. • A lot of common things with ASP.NET MVC routing • Main differencies : – Defined in a module constructor – Each capturing segment pattern has a score – The route which has the best score (combining all the matching segments scores) has the priority – The order of route loading is not important unless two matching routes have the same score 6 Routing
  7. 7. • Aggregate all the framework pieces together • Responsible of the automatic discovery of modules, model binders, dependencies, etc. • Built on top of a IoC container (TinyIoc) • Can be replaced with another container (already available : ninject, structuremap, unity and more) • Can be overrided to change or add features 7 Bootstrapper
  8. 8. • Takes a “template” and an optional “model” and usually render HTML • Shipped with the SuperSimpleViewEngine (.html and .sshtml files) but can be replaced • Just adding a reference to them via the separate nuget package will make them available • Possibility to implement your own view engine and hook it up like any other 8 View engines
  9. 9. 9
  10. 10. Some other frameworks • FubuMVC – compositional, convention-based framework for complex web applications • OpenRasta – open-source .NET framework for building everything web, from web sites to RESTful APIs And of course : • ASP.NET MVC – You should already know what to insert here…
  11. 11. • Modules and application hooks • Content negociation • Authentication • Hosting and implementing a host • Application testing • Diagnostics and dashboard • Cryptography 11 And some more things
  12. 12. • • • 12 Links
  13. 13. 13 Questions
  14. 14. Find out more • On
  15. 15. About Betclic • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest Gaming,, Expekt… • Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association). • Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players.