The SPA template is for client-side apps only. Since you need self-hosted server-side too you should start with the Self-Hosted Client-Server Application. From there going single-page app means simply you will serve a single page from the server (a UI.Next Doc) and handle everything else on the client. You will probably have a bunch of RPC functions as well for exposing the server-side logic.

Staring from the self-hsoted client-server app you have an entry point on the server in Main.fs for inserting the client-side app:

1
2
3
4
5
6
7
let HomePage =
    Skin.WithTemplate "HomePage" <| fun ctx ->
        [
            Div [Text "HOME"]
            Div [ClientSide <@ Client.Main() @>]
            Links ctx
        ]

Client.Main() here returns WebSharper.Html.Client.Element which is the imperative building block for apps. Since ClientSide expects a Pagelet (more precisely a Html.Client.IControlBody interface), which a UI.Next Doc implements, you can simply return that in your Client.Main function and it will work all the same.

By on 7/27/2015 1:27 AM ()

Perfect! Thanks

By on 7/27/2015 7:03 AM ()
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