I think the project templates in visual studio themselves are good functioning examples

By on 4/3/2016 12:21 AM ()

I took it upon my self to write the simpliest possible client/server WebSharper site. The code uses Sitelet.Content to construct a Sitelet supporting the url, "/", to which responds with the text "Hello World!".

1
2
3
4
5
6
7
module SimpleSite

open WebSharper.Sitelets

[<Website>]
let SimpleSitelet =
    Sitelet.Content "/" 0 (fun ctx -> Content.Text "Hello World!")

Here we treat two Sitelets as combinable values using the provided Sitelet.Folder.

1
2
3
4
5
6
7
8
9
10
11
module SimpleSite

open WebSharper.Sitelets

[<Website>]
let SimpleSitelet =
    [
        Sitelet.Content ""     0 (fun ctx -> Content.Text <| (sprintf "%A" ctx).Replace(";",";<br/>") )
        Sitelet.Content "test" 1 (fun ctx -> Content.Text <| "test")
    ]
    |> Sitelet.Folder "/"
By on 3/23/2016 11:21 PM ()

Presently I am in the throws of figuring out Client/Server communication. There doesn't seem to be a simple example manifesting this in one file. And my intuitions are so far not helping my efforts.

My current test scenario is to augment the SinglePage template name list such that newly entered names are decorated with a value retrieved from the server via remoting prior to adding it to the list. It is starting to dawn on me that this scenario requires a Sitelet server that the SinglePage template does not provide.

By on 3/22/2016 2:23 PM ()

Just in case you missed it, there is also docs in WebSharper repo. https://github.com/intellifactory/websharper/blob/master/docs/Remoting.md

By on 3/23/2016 3:53 PM ()

I am curious, what issues did you encounter with running the examples? Normally, the process is documented under How to run the examples, and if there are issues there, we should get those straighted out indeed.

For the record, if anyone is looking for functioning examples, there are a couple dozen on this site and another hundred or so useful snippets on Try WebSharper. Perhaps the easiest way to get started with WebSharper is using Try WebSharper - here, snippets are simple SPAs and plug right in that template if one tries them.

By on 3/22/2016 1:47 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper