Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/FSharp/giraffe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This includes tests for plaintext and json serialization.

**Language**

* F# 4.1
* F# 4.6

**Platforms**

Expand Down
5 changes: 2 additions & 3 deletions frameworks/FSharp/giraffe/giraffe-stripped.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down
5 changes: 2 additions & 3 deletions frameworks/FSharp/giraffe/giraffe-utf8direct.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down
5 changes: 2 additions & 3 deletions frameworks/FSharp/giraffe/giraffe-utf8json.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down
5 changes: 2 additions & 3 deletions frameworks/FSharp/giraffe/giraffe.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down
20 changes: 7 additions & 13 deletions frameworks/FSharp/giraffe/src/App/App.fsproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>preview</LangVersion>
<DebugType>portable</DebugType>
<AssemblyName>App</AssemblyName>
<OutputType>Exe</OutputType>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Giraffe" Version="3.5.0" />
<PackageReference Include="Npgsql" Version="4.0.4" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
<PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="Giraffe" Version="3.6.0" />
<PackageReference Include="Npgsql" Version="4.0.9" />
<PackageReference Update="FSharp.Core" Version="4.7" />
</ItemGroup>

<ItemGroup>
Expand All @@ -27,8 +25,4 @@
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
</ItemGroup>

</Project>
</Project>
8 changes: 4 additions & 4 deletions frameworks/FSharp/giraffe/src/App/Custom.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ open System.IO

let private DefaultCapacity = 1386
let private MaxBuilderSize = DefaultCapacity * 3
let private BufferSize = 27

type MemoryStreamCache =

Expand Down Expand Up @@ -43,13 +44,12 @@ let application : HttpHandler =
let inline contentLength x = new Nullable<int64> ( int64 x )

let json' data : HttpHandler =
let bytes = Utf8Json.JsonSerializer.Serialize(data)
fun _ ctx ->
ctx.Response.ContentLength <- contentLength bytes.Length
ctx.Response.ContentLength <- contentLength BufferSize
ctx.Response.ContentType <- "application/json"
ctx.Response.StatusCode <- 200
task {
do! ctx.Response.Body.WriteAsync(bytes, 0, bytes.Length)
do! System.Text.Json.JsonSerializer.SerializeAsync(ctx.Response.Body, data)
return Some ctx
}

Expand Down Expand Up @@ -108,7 +108,7 @@ let application : HttpHandler =

routes' [
"/plaintext", text' "Hello, World!"
"/json", json' { JsonStructMessage.message = "Hello, World!" }
"/json", json' struct {| message = "Hello, World!" |}
"/fortunes", fortunes'
]

5 changes: 0 additions & 5 deletions frameworks/FSharp/giraffe/src/App/Models.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
open System.Collections.Generic
open System

type JsonMessage = { message : string }

[<Struct>]
type JsonStructMessage = { message : string }

[<CLIMutable>]
type Fortune = { id: int; message: string }

Expand Down
2 changes: 1 addition & 1 deletion frameworks/FSharp/giraffe/src/App/Stock.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ let application : HttpHandler =

choose [
route "/plaintext" >=> text "Hello, World!"
route "/json" >=> json { JsonMessage.message = "Hello, World!" }
route "/json" >=> json {| message = "Hello, World!" |}
route "/fortunes" >=> fortunes
]
2 changes: 1 addition & 1 deletion frameworks/FSharp/zebra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Zebra is a new F# functional Asp.net Framework Wrapper that utalises a shared st

**Language**

* F# 4.1
* F# 4.6

**Platforms**

Expand Down
16 changes: 5 additions & 11 deletions frameworks/FSharp/zebra/src/App/App.fsproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>preview</LangVersion>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cartermp oups I copied this from the csproj changes. Is it doing anything in the F#?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will turn on some features, but if they're not used, then no difference.

Bugs and perf improvements are irrespective of LangVersion

<DebugType>portable</DebugType>
<AssemblyName>App</AssemblyName>
<OutputType>Exe</OutputType>
<EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Primitives" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Npgsql" Version="4.0.4" />
<PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="Npgsql" Version="4.0.9" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
<PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -32,8 +30,4 @@
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.0" />
</ItemGroup>

</Project>
5 changes: 2 additions & 3 deletions frameworks/FSharp/zebra/zebra-simple.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down
5 changes: 2 additions & 3 deletions frameworks/FSharp/zebra/zebra.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
WORKDIR /app
COPY src/App .
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
ENV ASPNETCORE_URLS http://+:8080
ENV COMPlus_ReadyToRun 0
WORKDIR /app
COPY --from=build /app/out ./

Expand Down