3 people like it.
Like the snippet!
OWIN Self-Host web-server
Simple OWIN Self-Host web-server with static files support and request deflate/gzip compression.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
|
(Nuget includes)
open Owin
open System
type MyStartup() =
member __.Configuration(app:Owin.IAppBuilder) =
let app1 = app.UseCompressionModule()
app1.UseFileServer "/." |> ignore
()
let server = Microsoft.Owin.Hosting.WebApp.Start<MyStartup> "http://*:6000"
Console.WriteLine "Press Enter to stop & quit."
Console.ReadLine() |> ignore
server.Dispose()
|
#if INTERACTIVE
#I @"./packages/Owin/lib/net40"
#I @"./packages/Owin.Compression/lib/net45"
#I @"./packages/Microsoft.Owin/lib/net45"
#I @"./packages/Microsoft.Owin.Hosting/lib/net45"
#I @"./packages/Microsoft.Owin.Host.HttpListener/lib/net45"
#I @"./packages/Microsoft.Owin.StaticFiles/lib/net45"
#I @"./packages/Microsoft.Owin.FileSystems/lib/net45"
#r "Owin.dll"
#r "Microsoft.Owin.dll"
#r "Microsoft.Owin.FileSystems.dll"
#r "Microsoft.Owin.Hosting.dll"
#r "Microsoft.Owin.StaticFiles.dll"
#r "System.Configuration.dll"
#r "Owin.Compression.dll"
#endif
namespace Owin
namespace System
Multiple items
type MyStartup =
new : unit -> MyStartup
member Configuration : app:IAppBuilder -> unit
Full name: Script.MyStartup
--------------------
new : unit -> MyStartup
Multiple items
member MyStartup.Configuration : app:Owin.IAppBuilder -> unit
Full name: Script.MyStartup.Configuration
--------------------
namespace System.Configuration
val app : Owin.IAppBuilder
type IAppBuilder =
member Build : returnType:Type -> obj
member New : unit -> IAppBuilder
member Properties : IDictionary<string, obj>
member Use : middleware:obj * [<ParamArray>] args:obj[] -> IAppBuilder
Full name: Owin.IAppBuilder
val app1 : obj
val ignore : value:'T -> unit
Full name: Microsoft.FSharp.Core.Operators.ignore
val server : IDisposable
Full name: Script.server
namespace Microsoft
namespace Microsoft.Owin
namespace Microsoft.Owin.Hosting
type WebApp =
static member Start<'TStartup> : url:string -> IDisposable + 5 overloads
Full name: Microsoft.Owin.Hosting.WebApp
Owin.Hosting.WebApp.Start(options: Owin.Hosting.StartOptions) : IDisposable
Owin.Hosting.WebApp.Start(url: string) : IDisposable
Owin.Hosting.WebApp.Start<'TStartup>(options: Owin.Hosting.StartOptions) : IDisposable
Owin.Hosting.WebApp.Start<'TStartup>(url: string) : IDisposable
Owin.Hosting.WebApp.Start(options: Owin.Hosting.StartOptions, startup: Action<Owin.IAppBuilder>) : IDisposable
Owin.Hosting.WebApp.Start(url: string, startup: Action<Owin.IAppBuilder>) : IDisposable
type Console =
static member BackgroundColor : ConsoleColor with get, set
static member Beep : unit -> unit + 1 overload
static member BufferHeight : int with get, set
static member BufferWidth : int with get, set
static member CapsLock : bool
static member Clear : unit -> unit
static member CursorLeft : int with get, set
static member CursorSize : int with get, set
static member CursorTop : int with get, set
static member CursorVisible : bool with get, set
...
Full name: System.Console
Console.WriteLine() : unit
(+0 other overloads)
Console.WriteLine(value: string) : unit
(+0 other overloads)
Console.WriteLine(value: obj) : unit
(+0 other overloads)
Console.WriteLine(value: uint64) : unit
(+0 other overloads)
Console.WriteLine(value: int64) : unit
(+0 other overloads)
Console.WriteLine(value: uint32) : unit
(+0 other overloads)
Console.WriteLine(value: int) : unit
(+0 other overloads)
Console.WriteLine(value: float32) : unit
(+0 other overloads)
Console.WriteLine(value: float) : unit
(+0 other overloads)
Console.WriteLine(value: decimal) : unit
(+0 other overloads)
Console.ReadLine() : string
IDisposable.Dispose() : unit
More information