Skip to content

Instantly share code, notes, and snippets.

@beyond-code-github
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyond-code-github/a7f70d9936ae97b79248 to your computer and use it in GitHub Desktop.
Save beyond-code-github/a7f70d9936ae97b79248 to your computer and use it in GitHub Desktop.
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