mini-training: nancyfx

15
NancyFX The super-duper-happy-path

Upload: betclic-everest-group-tech-team

Post on 10-May-2015

957 views

Category:

Technology


1 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Mini-Training: NancyFX

NancyFX The super-duper-happy-path

Page 2: Mini-Training: NancyFX

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

Page 3: Mini-Training: NancyFX

• 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

Page 4: Mini-Training: NancyFX

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

Page 5: Mini-Training: NancyFX

• Define the behavior of your application

• Must inherit NancyModule and are globally discovered

5

Modules

Page 6: Mini-Training: NancyFX

• 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

Page 7: Mini-Training: NancyFX

• 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

Page 8: Mini-Training: NancyFX

• 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

Page 9: Mini-Training: NancyFX

9

Page 10: Mini-Training: NancyFX

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…

Page 11: Mini-Training: NancyFX

• Modules and application hooks

• Content negociation

• Authentication

• Hosting and implementing a host

• Application testing

• Diagnostics and dashboard

• Cryptography

11

And some more things

Page 13: Mini-Training: NancyFX

13

Questions

Page 14: Mini-Training: NancyFX

Find out more

• On https://techblog.betclicgroup.com/

Page 15: Mini-Training: NancyFX

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, bet-at-home.com, 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.