Snippets tagged web

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs ( Composition is achieved through the use of the HttpRequestMessage -> Async signature. Pushing the app calls in the MessageHandler intercepts all requests and allows you to take control at the earliest point possible before operation selection occurs. Extending this slightly to call the innerChannel's SendAsync would allow you to create a middleware layer that would work both with this and other, normal Web API services.

    56 people like this

    Posted: 9 years ago by Ryan Riley

  • Web Crawler

    This snippet features an F# Web crawler that i'm already using in 2 applications (slightly modified). It's based on a scalable network of communicating agents that follow URLs extracted from HTML pages until reaching the specified limit.

    23 people like this

    Posted: 9 years ago by Taha Hachana

  • WebSharper Hello World

    This sample implements "Hello, world!" as a WebSharper application. It demonstrates how to compose HTML/XML using combinators, how to dynamically create a button with a handler and how to update an existing DOM element.

    4 people like this

    Posted: 9 years ago by Tomas Petricek

  • Web Crawler extensions

    The snippet extends a web crawler from snippet It synchronizes all printing using an additional agent (so printed text does not interleave) and the crawling function returns an asynchronous workflow that returns when crawling completes.

    9 people like this

    Posted: 9 years ago by Tomas Petricek

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    6 people like this

    Posted: 8 years ago by Mauricio Scheffer

  • Type-safe URL templates for Nancy

    The Nancy web framework parses URLs for you, and passes requests under a given URL route and HTTP method to your program. It relies heavily on C# dynamic objects; these don't translate well in F# code, and it's easy to make mistakes that only show up at run time. Here we define one F# record type for each route, with an attribute that defines the URL, with placeholders for each field in the record. These types implement one generic interface for each HTTP method they support: for GET, PUT and POST, these generic interfaces also specify the types of the HTTP request and response bodies.

    5 people like this

    Posted: 7 years ago by Tim Robinson

  • Get url opened by Google Chrome's main window

    This is a small example of invoking Win32 API. It gets the url which is opened by Google chrome's main window.

    3 people like this

    Posted: 7 years ago by nagat01

  • Helpers for formatting dates and strings

    Simplistic helpers for formatting dates and strings in a web server (strip HTML tags when reading RSS feeds, nicely format dates etc.)

    2 people like this

    Posted: 5 years ago by Tomas Petricek

  • WebSharper: compile a quotation to JavaScript

    This function compiles an F# quotation to a JavaScript string, or prints errors to stderr and returns None on failure.

    4 people like this

    Posted: 5 years ago by Loïc `Tarmil` Denuzière

  • REST For Free

    HttpListener + FParsec + Pattern Matching = Simple REST Endpoints

    3 people like this

    Posted: 4 years ago by Ted Cackowski Jr

  • Simple HTTP Server

    Simple HTTP server, runs on .Net Core, .Net or Mono, and serves GET requests via a handler. The example given serves up static content from a specified directory.

    4 people like this

    Posted: 4 years ago by Phillip Trelford

  • Start and stop a Suave web server

    To get a fast feedback loop going with web apps, you can run your experiments using the fsi, starting and restarting the web server each time without having to go through a slow msbuild cycle.

    3 people like this

    Posted: 2 years ago by Chui Tey

  • Send file via HTML5 to Web server

    Send file via HTML5 with a XMLHttpRequest to WebSharper Sitelet

    0 people like this

    Posted: 10 months ago by giuliohome

  • Send HTTP Post Request (Handling error info)

    Based on Tomas Petricek's: . Shows how to handle non OK (200) response codes, where .Net raises an exception upon GetResponse(), which makes it difficult to recover further error information. Here the snippet shows how to handle errors wrapping a Result type.

    2 people like this

    Posted: 1 month ago by Joan Arnaldich