<commit_before>taliesin
========

OWIN routing middleware using F# Agents

[![Build status](https://ci.appveyor.com/api/projects/status/b3erdf5knem9v0cy)](https://ci.appveyor.com/project/panesofglass/taliesin)

[![Build Status](https://travis-ci.org/frank-fs/taliesin.svg?branch=master)](https://travis-ci.org/frank-fs/taliesin)<commit_msg>Add sample to the README [skip ci]<commit_after>taliesin
========

OWIN routing middleware using F# Agents

[![Build status](https://ci.appveyor.com/api/projects/status/b3erdf5knem9v0cy)](https://ci.appveyor.com/project/panesofglass/taliesin)

[![Build Status](https://travis-ci.org/frank-fs/taliesin.svg?branch=master)](https://travis-ci.org/frank-fs/taliesin)

Hello, world
--------
``` fsharp
namespace FSharpWeb4

open Owin
open Microsoft.Owin
open System
open System.Net
open System.Net.Http
open System.Web
open Dyfrig
open Taliesin

type Resources = Home
    with
    interface IUriRouteTemplate with
        member x.UriTemplate = "/"

module App =
    let makeHttpHandler statusCode (data: byte[]) =
        let handler (request: HttpRequestMessage) =
            let content = new ByteArrayContent(data)
            content.Headers.ContentLength <- Nullable data.LongLength
            content.Headers.ContentType <- Headers.MediaTypeHeaderValue("text/plain")
            new HttpResponseMessage(statusCode, Content = content, RequestMessage = request)
            |> async.Return
        Dyfrig.SystemNetHttpAdapter.fromAsyncSystemNetHttp handler

    let spec = RouteLeaf(Home, [GET(makeHttpHandler HttpStatusCode.OK "Hello from Taliesin!"B)])

type Startup() =
    member x.Configuration(app: IAppBuilder) =
        let taliesin = new ResourceManager<Resources>()
        let subscription = taliesin.Start(App.spec)
        app.Use(fun _ -> taliesin.Invoke) |> ignore

type Global() =
    inherit System.Web.HttpApplication() 

[<assembly:OwinStartup(typeof<Startup>)>]
do ()
```
{'fraction_non_alphanumeric': 0.13250517598343686, 'fraction_numerical': 0.004658385093167702, 'mean_word_length': 4.020779220779221, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4057577', 'n_tokens_mistral': 626, 'n_tokens_neox': 614, 'n_words': 115}