OWIN Web API with Linky

25
OWIN AND WEB API 2.2 Oslo/NNUG Tomas Jansson 26/08/2014

description

Introduction to OWIN and demonstration of mainly attribute routing in Web API 2 together with Linky from Zudio.

Transcript of OWIN Web API with Linky

Page 1: OWIN Web API with Linky

OWIN AND WEB API 2.2

Oslo/NNUG

Tomas Jansson

26/08/2014

Page 2: OWIN Web API with Linky

THIS IS ME

Tomas Jansson

Manager & Practice Lead .NETBEKK Oslo

@[email protected]/mastojblog.tomasjansson.com

Page 3: OWIN Web API with Linky

AGENDA

What is OWIN

Show me MORE CODE!

TerminologyShow me the

code!

RESTWeb API 2.2

Page 4: OWIN Web API with Linky

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/

Page 5: OWIN Web API with Linky

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

Page 6: OWIN Web API with Linky

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

Page 7: OWIN Web API with Linky

TERMINOLOGY

Actors Environment AppFunc

Page 8: OWIN Web API with Linky

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

Page 9: OWIN Web API with Linky

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

Page 10: OWIN Web API with Linky

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

Page 11: OWIN Web API with Linky

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

Page 12: OWIN Web API with Linky

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

Page 13: OWIN Web API with Linky

ENVIRONMENT

http://mashable.com/2013/06/13/dictionary-new-words-2013/

Page 14: OWIN Web API with Linky

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.

Page 15: OWIN Web API with Linky

APPFUNC – THE APPLICATION DELEGATE

http://casopisinterfon.org/2014/03/11/da-li-funk-od-balkana-pravi-pesme-ili-balkan-od-funka-pravi-slona/

Page 16: OWIN Web API with Linky

APPFUNC – THE APPLICATION DELEGATE

using AppFunc = Func<IDictionary<string, object>, // Environment

Task>; // Done

Page 17: OWIN Web API with Linky
Page 18: OWIN Web API with Linky

WEB API 2.2

Full OWIN support

Attribute routing

Global error handling

Multiple OData improvements

Page 19: OWIN Web API with Linky

REST/RICHARDSON’S MATURITY MODEL

http://martinfowler.com/articles/images/richardsonMaturityModel/overview.png

Page 20: OWIN Web API with Linky

REST/RICHARDSON’S MATURITY MODEL

This is our goal today!

http://martinfowler.com/articles/images/richardsonMaturityModel/overview.png

Page 21: OWIN Web API with Linky

https://github.com/mastoj/OwinLinkyApi

Page 22: OWIN Web API with Linky

Summary

Time to pick up OWIN

Key components

of OWIN: Environment and AppFunc

REST level 3 is doable!

Page 23: OWIN Web API with Linky

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

Page 24: OWIN Web API with Linky

Questions?

Page 25: OWIN Web API with Linky

Thank you!

@TomasJansson