Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Ryan Riley
Tachyus
 Tachyus’ success with F#
 Data Access
 Web APIs
 Handling Exceptions
 Managing Builds
 Questions
 ASP.NET Web API hosted in Azure
 AngularJS-based SPA providing information to office
workers
 iOS application for work...
 Less code
 Get things done faster
 Type safety
 Expressive syntax
 Full .NET compatibility
 Active, strong communit...
 DbmlFile and SqlDataConnection (LINQ to SQL)
 EdmxFile and SqlEntityConnection (Entity Framework)
 SQL Provider
 FSha...
“SQL is the best DSL for working with data”
- Rob Conery, http://www.infoq.com/articles/ORM-Saffron-
Conery
HttpRequestMessage -> HttpResponseMessage
Request/Response
 Methods, URIs, Status Codes
Headers (info on client, server, request type, etc)
 General, Request, Res...
GET /item/1
+ POST /item/1
+ PUT /item/1
+ DELETE /item/1
+ OPTIONS /item/1
GET (or POST) /
+ /items
+ /item/{itemId}
+ /s...
 Serve functional Web APIs
 Consume HTTP with pattern matching
 F# DSL using System.Net.Http
 Headers composition
 Follows the natural composition of HTTP
 Frank Resources == HTTP R...
HttpRequestMessage -> HttpResponseMessage
HttpRequestMessage -> Async<HttpResponseMessage>
// handler
let echo request = async {
let! body = request.Content.AsyncReadAsString()
return request.CreateResponse(HttpSt...
let helloworld request = async { … }
let echo request = async { … }
let resource = route “/” (get helloworld <|> post echo)
let todoListResource = route “/” (get todoList <|> …)
let todoItemResource = route “/item/{1}” (put …)
config |> register ...
 Works out of the box using a F# library and C# web project
 F# MVC 5 project template
 Frank
 http://www.slideshare.net/ScottWlaschin/railway-oriented-
programming
 http://fsharpforfunandprofit.com/posts/recipe-pa...
“FAKE is a Domain Specific Language that you can use without knowing F#, but if
and when you outgrow it you can keep headi...
 WebSharper and FunScript – F# -> JavaScript compilers
 VegaHub – interactive charting from the F# interactive
window
 ...
 F# Software Foundation
 Community for F#
 Sergey Tihon’s F# Weekly
 F# for Fun and Profit
 Real World Functional Pro...
F# on the Web
F# on the Web
F# on the Web
F# on the Web
F# on the Web
F# on the Web
Upcoming SlideShare
Loading in …5
×

F# on the Web

934 views

Published on

Look at building web APIs with F# using ASP.NET Web API and the FSharp.Data.SqlClient type provider.

  • Be the first to comment

F# on the Web

  1. 1. Ryan Riley Tachyus
  2. 2.  Tachyus’ success with F#  Data Access  Web APIs  Handling Exceptions  Managing Builds  Questions
  3. 3.  ASP.NET Web API hosted in Azure  AngularJS-based SPA providing information to office workers  iOS application for workers in oil fields
  4. 4.  Less code  Get things done faster  Type safety  Expressive syntax  Full .NET compatibility  Active, strong community (small but growing!)
  5. 5.  DbmlFile and SqlDataConnection (LINQ to SQL)  EdmxFile and SqlEntityConnection (Entity Framework)  SQL Provider  FSharp.Data.SqlClient <- we use this one
  6. 6. “SQL is the best DSL for working with data” - Rob Conery, http://www.infoq.com/articles/ORM-Saffron- Conery
  7. 7. HttpRequestMessage -> HttpResponseMessage
  8. 8. Request/Response  Methods, URIs, Status Codes Headers (info on client, server, request type, etc)  General, Request, Response, Content Resources –  “anything that has identity”–RFC2396
  9. 9. GET /item/1 + POST /item/1 + PUT /item/1 + DELETE /item/1 + OPTIONS /item/1 GET (or POST) / + /items + /item/{itemId} + /setresult?foo=bar HTTP Resource HTTP “Service”
  10. 10.  Serve functional Web APIs  Consume HTTP with pattern matching
  11. 11.  F# DSL using System.Net.Http  Headers composition  Follows the natural composition of HTTP  Frank Resources == HTTP Resources  Define your own conventions!
  12. 12. HttpRequestMessage -> HttpResponseMessage HttpRequestMessage -> Async<HttpResponseMessage>
  13. 13. // handler let echo request = async { let! body = request.Content.AsyncReadAsString() return request.CreateResponse(HttpStatusCode.OK, body) } // method handler get echo
  14. 14. let helloworld request = async { … } let echo request = async { … } let resource = route “/” (get helloworld <|> post echo)
  15. 15. let todoListResource = route “/” (get todoList <|> …) let todoItemResource = route “/item/{1}” (put …) config |> register [todoListResource;todoItemResource]
  16. 16.  Works out of the box using a F# library and C# web project  F# MVC 5 project template  Frank
  17. 17.  http://www.slideshare.net/ScottWlaschin/railway-oriented- programming  http://fsharpforfunandprofit.com/posts/recipe-part2/
  18. 18. “FAKE is a Domain Specific Language that you can use without knowing F#, but if and when you outgrow it you can keep heading down the F# road. In all cases you've got all of .NET at your command.” - Scott Hanselman, http://www.hanselman.com/blog/ExploringFAKEAnFBuildSystemForAllOfNET.asp x
  19. 19.  WebSharper and FunScript – F# -> JavaScript compilers  VegaHub – interactive charting from the F# interactive window  F# Web Stack – OWIN-based tools for building web APIs  Work in progress to merge Frank + HyperF + Dyfrig + Taliesin
  20. 20.  F# Software Foundation  Community for F#  Sergey Tihon’s F# Weekly  F# for Fun and Profit  Real World Functional Programming on MSDN

×