The three main WebSharper application types are:
-
Client-Server Application - a full client-server application implemented as a WebSharper sitelet.
The sitelet uses a dynamic HTML template and placeholders that are instantiated by the sitelet. See the HTML templates page for more information on dynamic templating.
These applications exist in two kinds: a Client-Server Web Application runs as an ASP.NET module, while a Self-Hosted Client-Server Web Application runs as a self-contained executable using an OWIN self-host container.
-
HTML Application - a multi-page HTML/JavaScript application.
Like the Client-Server Application, this application also uses sitelets and dynamic HTML templates to define web pages. However, it creates a set of static HTML and JavaScript files that can be deployed in any HTML container.
WebSharper mobile web applications can also be created from this template.
-
Single-Page Application - a single-page HTML/JavaScript application with an HTML page and an F# source file that plugs content into it.
The easiest way to get started with WebSharper: write a few lines of F#, add a placeholder for it in the HTML, and you are ready to go.
See the "Your first app in 2 minutes" tab for an example.
The following helper projects are also available:
-
Library - a simple WebSharper library. Annotated code is compiled to JavaScript, and can then be used from any application project.
-
Extension - defines the interface to an existing JavaScript library using a convenient declarative F# syntax.
This table summarizes the capabilities of the available application/helper project templates:
Template | All-F# | Is Sitelet? | Client | Server | Remote |
---|---|---|---|---|---|
Applications | |||||
Client-Server App ASP.NET-based or self-hosted via OWIN |
|||||
HTML App | |||||
Single-Page App | |||||
Helpers | |||||
Library | |||||
Extension | |||||
ASP.NET Container |
-
Client - Contains code compiled to JavaScript, executing on the client-side.
-
Server - Contains code you deploy for your application, executing on your server-side.
-
Remote - Contains code you from someone else's server, typically through a web service.
WebSharper project files must include the file WebSharper.targets
, which defines the necessary compilation tasks. The type of project is driven by the property WebSharperProject
. Here are the possible values:
Site
: for Client-Server Applications.- Compiles JavaScript-annotated code;
- Extracts resources in the folders
Content/WebSharper
andScripts/WebSharper
.
Html
: for HTML Applications.- Compiles JavaScript-annotated code;
- Generates HTML files in
$(WebSharperHtmlDirectory)
and extracts resources in$(WebSharperHtmlDirectory)/Content/WebSharper
and$(WebSharperHtmlDirectory)/Scripts/WebSharper
.
Bundle
: for Single-Page Applications.- Compiles JavaScript-annotated code;
- Extracts and concatenates resources into the folder
Content
.
Library
: for Libraries.- Compiles JavaScript-annotated code.
InterfaceGenerator
: For Extensions.- Compiles the classes defined using WIG into an assembly.
The other MSBuild project variables are fully documented here.