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.

    57 people like this

    Posted: 13 years ago by Ryan Riley

  • Asynchronous Controller Helper

    The snippet declares a helper for creating asynchronous controllers for ASP.NET MVC 3. It declares a new base class for asynchronous actions that exposes a computation builder for writing actions using F# asynchronous workflows.

    8 people like this

    Posted: 13 years ago by Tomas Petricek

  • Asynchronous Workflow Controller

    The snippet overrides default AsyncControllerActionInvoker so F# async workflows can be used for ASP.NET MVC 3. It declares a new base class for asynchronous controller. Controller method has to have return type Async.

    5 people like this

    Posted: 13 years ago by Dmitry Morozov

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    6 people like this

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

  • REST For Free

    HttpListener + FParsec + Pattern Matching = Simple REST Endpoints

    3 people like this

    Posted: 9 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.

    7 people like this

    Posted: 8 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.

    4 people like this

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

  • Send HTTP Post Request (Handling error info)

    Based on Tomas Petricek's: http://fssnip.net/a7 . 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: 4 years ago by Joan Arnaldich

  • 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.

    8 people like this

    Posted: 3 years ago by Taha Hachana

  • 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.

    0 people like this

    Posted: 1 year ago by Tomas Petricek