Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hello world in Superscribe - F# style
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Owin" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Hosting" version="3.0.0" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Superscribe" version="0.4.4.15" targetFramework="net45" />
<package id="Superscribe.Owin" version="0.4.3.14" targetFramework="net45" />
</packages>
namespace Server
open Owin
open Microsoft.Owin
open Superscribe.Owin
open Superscribe.Owin.Engine
open Superscribe.Owin.Extensions;
type Startup() =
member x.Configuration(app: Owin.IAppBuilder) =
let define = OwinRouteEngineFactory.Create();
app.UseSuperscribeRouter(define).UseSuperscribeHandler(define) |> ignore
define.Route("/hello/world", fun _ -> "Hello World" :> obj) |> ignore
define.Route("/hello/fsharp", fun _ -> "Hello from F#!" :> obj) |> ignore
[<assembly: OwinStartup(typeof<Startup>)>]
do ()
open System
open Microsoft.Owin
[<EntryPoint>]
let main argv =
let baseAddress = "http://localhost:8888";
use a = Hosting.WebApp.Start<Server.Startup>(baseAddress)
Console.WriteLine("Server running on {0}", baseAddress)
Console.ReadLine() |> ignore
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.