Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 88a51d5

Browse files
Step 1 for Quatro is done
1 parent 99afbc9 commit 88a51d5

File tree

4 files changed

+43
-13
lines changed

4 files changed

+43
-13
lines changed

src/2-Nancy-CSharp/Startup.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ namespace Dos
66

77
public class Startup
88
{
9-
public void Configure(IApplicationBuilder app)
10-
{
9+
public void Configure(IApplicationBuilder app) =>
1110
app.UseOwin(x => x.UseNancy());
12-
}
1311
}
1412
}

src/3-Nancy-FSharp/App.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Learn more about F# at http://fsharp.org
2-
namespace Tres
1+
namespace Tres
32

43
open Microsoft.AspNetCore.Builder
54
open Microsoft.AspNetCore.Hosting

src/4-Freya-FSharp/App.fs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
1-
// Learn more about F# at http://fsharp.org
1+
namespace Quatro
22

3-
open System
3+
open Freya.Core
4+
open Freya.Machines.Http
5+
open Freya.Routers.Uri.Template
6+
open Microsoft.AspNetCore.Builder
7+
open Microsoft.AspNetCore.Hosting
48

5-
[<EntryPoint>]
6-
let main argv =
7-
printfn "Hello World!"
8-
0 // return an integer exit code
9+
module App =
10+
let hello =
11+
freya {
12+
return Represent.text "Hello World from Freya"
13+
}
14+
15+
let machine =
16+
freyaMachine {
17+
handleOk hello
18+
}
19+
20+
let router =
21+
freyaRouter {
22+
resource "/" machine
23+
}
24+
25+
type Startup () =
26+
member __.Configure (app : IApplicationBuilder) =
27+
let freyaOwin = OwinMidFunc.ofFreya (UriTemplateRouter.Freya router)
28+
app.UseOwin (fun p -> p.Invoke freyaOwin) |> ignore
29+
30+
[<EntryPoint>]
31+
let main _ =
32+
use host = (new WebHostBuilder()).UseKestrel().UseStartup<Startup>().Build()
33+
host.Run()
34+
0

src/4-Freya-FSharp/project.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"dependencies": {
1313
"Freya": "3.0.0-rc01",
1414
"Microsoft.AspNetCore.Owin": "1.0.0",
15-
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
15+
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
16+
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
1617
},
1718
"frameworks": {
1819
"netcoreapp1.0": {
@@ -22,7 +23,13 @@
2223
"version": "1.0.1"
2324
},
2425
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160831"
25-
}
26+
},
27+
"imports": [
28+
"portable-net45+win8+dnxcore50",
29+
"portable-net45+win8",
30+
"net452",
31+
"dnxcore50"
32+
]
2633
}
2734
},
2835
"tools": {

0 commit comments

Comments
 (0)