Snippets tagged web

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs (http://wcf.codeplex.com/). 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: 6 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.

    22 people like this

    Posted: 6 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: 5 years ago by Tomas Petricek

  • Web Crawler extensions

    The snippet extends a web crawler from snippet http://fssnip.net/3K. 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: 5 years ago by Tomas Petricek

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    6 people like this

    Posted: 5 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: 4 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.

    2 people like this

    Posted: 3 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: 1 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: 1 years ago by Loïc `Tarmil` Denuzière

  • REST For Free

    HttpListener + FParsec + Pattern Matching = Simple REST Endpoints

    3 people like this

    Posted: 1 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: 12 months ago by Phillip Trelford

  • Send async HTTP POST request

    Bit like http://www.fssnip.net/a7 but send as async.

    2 people like this

    Posted: 10 months ago by Tuomas Hietanen