Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
FrankThe Web API DSL
Ryan RileyO Logos Bible SoftwareO Community for F#O F# MVPO OSS: FSharpx, Fracture, FrankO @panesofglass
HTTP PartsO Request/Response Lines  O Methods, URIs, Status CodesO Headers  O General, Request, Response, ContentO Resourc...
FrankO F# DSL using System.Net.HttpO Headers compositionO Follows the natural composition of HTTPO Frank Resources == HTTP...
Function CompositionO Functional programming offers solutions to these problems  O Filter  O Map  O Reduce
Simplest HTTP Application  HttpRequestMessage -> HttpResponseMessage
Simplest HTTP Frank    Application   HttpRequestMessage -> HttpResponseMessageHttpRequestMessage -> Async<HttpResponseMess...
ResourcesGET /item/1+ POST /item/1+ PUT /item/1+ OPTIONS /item/1=Resource at / with GET, POST, PUT, &OPTIONS
Define a Method Handler// handlerlet echo request = async {  let! body = request.Content.AsyncReadAsString()  return HttpR...
Define a Resourcelet helloworld request = async { … }let echo request = async { … }let resource = route “/” (get helloworl...
HTTP Applications/+ /items+ /item/{itemId}+ /help=Typical HTTP “application”
Define an Applicationlet todoListResource = route “/” (get todoList <|> …)let todoItemResource = route “/item/{1}” (put …)...
Content NegotiationClient Accepts              Server Supportsapplication/xml;q=0.9       application/jsonapplication/json...
Leverage Connegval negotiateMediaType = formatters ->                         HttpRequestMessage ->                       ...
Summary
ResourcesO ASP.NET Web Forms in F#O ASP.NET MVC in F#O Figment DSL for MVCO Frank DSL for Web APIO WebSharperO Pit FW
Thank you!O Please rate this talk:  http://speakerrate.com/talks/9334-frank-the-web-api-dsl
Próxima SlideShare
Cargando en…5
×

Frank: The Web API DSL

1.870 visualizaciones

Publicado el

Most .NET web applications today use ASP.NET WebForms or MVC. However, several F# libraries offer new ways to build web APIs and applications help reduce code and offer better abstractions, especially for single-page applications (SPA). How can F# improve the situation? Frank is a minimal, domain-specific library designed to leverage the power of HTTP using functions directly.

Publicado en: Tecnología
  • Sé el primero en comentar

Frank: The Web API DSL

  1. 1. FrankThe Web API DSL
  2. 2. Ryan RileyO Logos Bible SoftwareO Community for F#O F# MVPO OSS: FSharpx, Fracture, FrankO @panesofglass
  3. 3. HTTP PartsO Request/Response Lines O Methods, URIs, Status CodesO Headers O General, Request, Response, ContentO ResourcesO RepresentationsO Hypermedia
  4. 4. FrankO F# DSL using System.Net.HttpO Headers compositionO Follows the natural composition of HTTPO Frank Resources == HTTP ResourcesO Define your own conventions!
  5. 5. Function CompositionO Functional programming offers solutions to these problems O Filter O Map O Reduce
  6. 6. Simplest HTTP Application HttpRequestMessage -> HttpResponseMessage
  7. 7. Simplest HTTP Frank Application HttpRequestMessage -> HttpResponseMessageHttpRequestMessage -> Async<HttpResponseMessage>
  8. 8. ResourcesGET /item/1+ POST /item/1+ PUT /item/1+ OPTIONS /item/1=Resource at / with GET, POST, PUT, &OPTIONS
  9. 9. Define a Method Handler// handlerlet echo request = async { let! body = request.Content.AsyncReadAsString() return HttpResponseMessage.ReplyTo(request, body)}// method handlerget echo
  10. 10. Define a Resourcelet helloworld request = async { … }let echo request = async { … }let resource = route “/” (get helloworld <|> post echo)
  11. 11. HTTP Applications/+ /items+ /item/{itemId}+ /help=Typical HTTP “application”
  12. 12. Define an Applicationlet todoListResource = route “/” (get todoList <|> …)let todoItemResource = route “/item/{1}” (put …)let app = merge [ todoListResource; todoItemResource ]
  13. 13. Content NegotiationClient Accepts Server Supportsapplication/xml;q=0.9 application/jsonapplication/json;q=0.8 text/plaintext/plain;q=0.5 text/html application/json
  14. 14. Leverage Connegval negotiateMediaType = formatters -> HttpRequestMessage -> string -> Async<HttpResponseMessage>let echo = negotiateMediaType formatters <| fun request -> request.Content.AsyncReadAsString())
  15. 15. Summary
  16. 16. ResourcesO ASP.NET Web Forms in F#O ASP.NET MVC in F#O Figment DSL for MVCO Frank DSL for Web APIO WebSharperO Pit FW
  17. 17. Thank you!O Please rate this talk: http://speakerrate.com/talks/9334-frank-the-web-api-dsl

×