owin web api with linky
DESCRIPTION
Introduction to OWIN and demonstration of mainly attribute routing in Web API 2 together with Linky from Zudio.TRANSCRIPT
OWIN AND WEB API 2.2
Oslo/NNUG
Tomas Jansson
26/08/2014
THIS IS ME
Tomas Jansson
Manager & Practice Lead .NETBEKK Oslo
@[email protected]/mastojblog.tomasjansson.com
AGENDA
What is OWIN
Show me MORE CODE!
TerminologyShow me the
code!
RESTWeb API 2.2
WHAT IS OWIN?
OWIN defines a standard interface between .NET web servers and web applications.
The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools.
http://owin.org/
WHAT IS OWIN?
OWIN defines a standard interface between .NET web servers and web applications.
The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools.
http://owin.org/WhatOWIN is
WHAT IS OWIN?
OWIN defines a standard interface between .NET web servers and web applications.
The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools.
http://owin.org/
The goal
TERMINOLOGY
Actors Environment AppFunc
ACTORS
Host: The process an application and server execute inside of, primarily responsible for application startup.
Example: Self-host, Nowin, IIS
http://owin.org/spec/owin-1.0.0.html
ACTORS
http://owin.org/spec/owin-1.0.0.html
Server: The HTTP server that directly communicates with the client and then uses OWIN semantics to process requests.
Examples: SystemWeb, Self-Host, Nowin
Host: The process an application and server execute inside of, primarily responsible for application startup.
Example: Self-host, Nowin, IIS
ACTORS
Middleware: A pass through component that handles cross cutting concerns. Acts as a pipeline between server and application.
Example: Security stuff
http://owin.org/spec/owin-1.0.0.html
Server: The HTTP server that directly communicates with the client and then uses OWIN semantics to process requests.
Examples: SystemWeb, Self-Host, Nowin
Host: The process an application and server execute inside of, primarily responsible for application startup.
Example: Self-host, Nowin, IIS
ACTORS
Middleware: A pass through component that handles cross cutting concerns. Acts as a pipeline between server and application.
Example: Security stuff
Web Framework: Self-contained components that you can base your applicationon.
Example: Web API, NancyFx, SignalR
http://owin.org/spec/owin-1.0.0.html
Server: The HTTP server that directly communicates with the client and then uses OWIN semantics to process requests.
Examples: SystemWeb, Self-Host, Nowin
Host: The process an application and server execute inside of, primarily responsible for application startup.
Example: Self-host, Nowin, IIS
ACTORS
Middleware: A pass through component that handles cross cutting concerns. Acts as a pipeline between server and application.
Example: Security stuff
Web Framework: Self-contained components that you can base your applicationon.
Example: Web API, NancyFx, SignalR
Web Application: This is the stuff you’re most likely to write.
http://owin.org/spec/owin-1.0.0.html
Server: The HTTP server that directly communicates with the client and then uses OWIN semantics to process requests.
Examples: SystemWeb, Self-Host, Nowin
Host: The process an application and server execute inside of, primarily responsible for application startup.
Example: Self-host, Nowin, IIS
ENVIRONMENT
http://mashable.com/2013/06/13/dictionary-new-words-2013/
ENVIRONMENT
The Environment dictionary stores information about the request, the response, and any relevant server state.
The server is responsible for providing body streams and header collections for both the request and response in the initial call.
The application then populates the appropriate fields with response data, writes the response body, and returns when done.
APPFUNC – THE APPLICATION DELEGATE
http://casopisinterfon.org/2014/03/11/da-li-funk-od-balkana-pravi-pesme-ili-balkan-od-funka-pravi-slona/
APPFUNC – THE APPLICATION DELEGATE
using AppFunc = Func<IDictionary<string, object>, // Environment
Task>; // Done
WEB API 2.2
Full OWIN support
Attribute routing
Global error handling
Multiple OData improvements
REST/RICHARDSON’S MATURITY MODEL
http://martinfowler.com/articles/images/richardsonMaturityModel/overview.png
REST/RICHARDSON’S MATURITY MODEL
This is our goal today!
http://martinfowler.com/articles/images/richardsonMaturityModel/overview.png
https://github.com/mastoj/OwinLinkyApi
Summary
Time to pick up OWIN
Key components
of OWIN: Environment and AppFunc
REST level 3 is doable!
RESOURCES
OWIN: http://owin.org/
Katana: https://katanaproject.codeplex.com/
Presentation: http://www.slideshare.net/mastoj/owin-web-api-with-linky
Source code: https://github.com/mastoj/OwinLinkyApi
Linky: https://github.com/zudio/Linky
Questions?
Thank you!
@TomasJansson