Thanks Adam. As I haven't fully understood all the WebSharper concepts yet, I obviously need to dive in deeper.

But now I'm curious how SPA views can reach out to a server for data.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Here's the kind of application that I want to build (preferably in a single project). 
	1) Client-side SPA
		A few standard views in the initial download 
		Many dynamically downloaded on-demand views
			With subsequent RPCs after view template is fetched and inserted
		Client-side URL routing (deep-links)
	2) Server component
		Basic CRUD RPCs REST APIs
		Some additional server views (post-backs)
        Menu integration between client and server routes
		Other
			Back-end activities
			OpenSeadragon images
			etc.
And I would like to incorporate the UiNext reactive approach.
By on 8/29/2015 5:01 PM ()

What you can do is have a separate client-server application for your server component, which will contain the RPC functions. Then in the SPA, add a reference to the client-server application and call this:

1
WebSharper.Remoting.EndPoint <- "http://your-clientserver-application-url"`

RPC requests will then be correctly sent to the server component.

By on 8/31/2015 1:17 AM ()

Is it possible to combine the SPA and server components to avoid the necessity of deploying two sites?

By on 8/31/2015 4:17 PM ()

To complement István's answer: looking into the SPA project file, you will see a property called <WebSharperBundleOutputDir> with the value Content. If you change that value to ../your-server-project-dir/Content, then the compiled SPA js and css files will be output in that directory. You can then copy the index.html from the SPA directory to the server project directory, and you're good to go.

By on 9/1/2015 1:32 AM ()

You can make a client-server app where the server only serves one end-point (/ for example) which will be your SPA, and the other endpoints will be for the REST API if you choose to build one.

By on 9/1/2015 1:04 AM ()

As a newbie to both F# and WebSharper, I'm finding it rather confusing to put together a simple SPA site with multiple pages, REST server endpoints, and client-side routing. Consequently, it would be very helpful to see the outline of an up-to-date example of a WebSharper site having the following characteristics:

1) UI.Next Client-Server
2) Single-Page Home Endpoint
3) REST Endpoints
4) Template Endpoints for other SPA pages (initial download)
5) Client-side routing (with the Home endpoint returning HTML slots for menu items)

I want to serve a "master" page template in the home page request and fetch HTML templates for additional pages on (first) demand with subsequent REST calls for data.

No doubt I'll eventually figure this out...but it would be nice if an example (or better yet a WebSharper project template) existed to show how this can be accomplished.

By on 9/15/2015 11:52 AM ()

Most bits here would be easy, for the client-side routing one you can check this snippet.

By on 9/16/2015 5:24 AM ()

That snippet was helpful. Thanks Adam! I've got it working...not exactly where I want to land yet. But by degrees I'm figuring it out.

By on 9/21/2015 11:45 AM ()

SPAs don't have a server-side, they are made up a single HTML file with generated JS behind it. To make server calls, you should use the client-server templates to get started.

By on 8/29/2015 2:52 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