Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dotnet-websharper/warp
WebSharper Warp is a friction-less web development library for building scripted and standalone full-stack F# client-server applications.
https://github.com/dotnet-websharper/warp
Last synced: 7 days ago
JSON representation
WebSharper Warp is a friction-less web development library for building scripted and standalone full-stack F# client-server applications.
- Host: GitHub
- URL: https://github.com/dotnet-websharper/warp
- Owner: dotnet-websharper
- License: apache-2.0
- Created: 2015-06-08T19:13:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-19T10:14:32.000Z (over 7 years ago)
- Last Synced: 2024-04-30T04:21:03.650Z (7 months ago)
- Language: F#
- Homepage:
- Size: 513 KB
- Stars: 17
- Watchers: 7
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# websharper.warp
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/intellifactory/websharper.warp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
WebSharper Warp is a friction-less web development library for building **scripted** and **standalone** **full-stack** F# client-server applications. Warp is built on top of WebSharper and is designed to help you become more productive in these scenarios by providing an API for on-the-fly compilation and an OWIN compliant server middleware for self-hosting or embedding sitelets in various compatible web servers.
**Update**: Note that many Warp shorthands have been integrated into WebSharper now. To use these new shorthands, you don't need Warp, but be sure to open `WebSharper.Sitelets` instead. (You can find the old getting started guide that uses Warp [here](getting-started.md)).
* `Warp.Page` -> `Content.Page`
* `Warp.Text` -> `Content.Text`
* `Warp.Json` -> `Content.Json`
* `Warp.CreateSPA` -> `Application.SinglePage`
* `Warp.CreateApplication` -> `Application.MultiPage`
# InstallingTo get started with Warp is super-easy, all you need is to open a new F# Console Application (or any other F# project type if you want to script applications), and add `WebSharper.Warp` to it:
```
Install-Package WebSharper.Warp
```Or if you use [Paket](http://fsprojects.github.io/Paket/):
```
paket init
paket add nuget WebSharper.Warp
```# Scripting with Warp
When you add the `WebSharper.Warp` NuGet package to your project in Visual Studio, a new document tab will open giving the necessary boilerplate for using Warp in scripted applications.
For instance, the SPA example above can be written as an F# script and executed in F# Interative:
```fsharp
#I "../packages/Owin.1.0/lib/net40"
#I "../packages/Microsoft.Owin.3.0.1/lib/net45"
#I "../packages/Microsoft.Owin.Host.HttpListener.3.0.1/lib/net45"
#I "../packages/Microsoft.Owin.Hosting.3.0.1/lib/net45"
#I "../packages/Microsoft.Owin.FileSystems.3.0.1/lib/net45"
#I "../packages/Microsoft.Owin.StaticFiles.3.0.1/lib/net45"
#I "../packages/WebSharper.3.2.8.170/lib/net40"
#I "../packages/WebSharper.Compiler.3.2.4.170/lib/net40"
#I "../packages/WebSharper.Owin.3.2.6.83/lib/net45"
#load "../packages/WebSharper.Warp.3.2.10.13/tools/reference.fsx"open WebSharper
open WebSharper.Html.Serverlet MySite =
Warp.CreateSPA (fun ctx ->
[H1 [Text "Hello world!"]])do Warp.RunAndWaitForInput(MySite) |> ignore
```If you use Paket, then you should replace the `#`-lines above with this one:
```fsharp
#load "../packages/WebSharper.Warp/tools/reference-nover.fsx"
```In FSI, you should see:
```
--> Added 'c:\sandbox\test\Library1\HelloWorld\../packages/Owin.1.0/lib/net40' to library include path
[... more lines ...][Loading c:\sandbox\test\Library1\packages\WebSharper.Warp.3.2.10.13\tools\reference.fsx]
namespace FSI_0004
Serving http://localhost:9000/, press Enter to stop.
```You can then test this application as before:
![](http://i.imgur.com/xYITvCql.png)