module Server open System.IO open System.Threading.Tasks open Microsoft.AspNetCore.Builder open Microsoft.Extensions.DependencyInjection open Giraffe open Saturn open Shared open Fable.Remoting.Server open Fable.Remoting.Giraffe let publicPath = Path.GetFullPath "../Client/public" let port = 8085us let getItems (start, qty) = async { let! items = Feed.loadMany [ "http://feeds.bbci.co.uk/news/rss.xml" "https://www.theguardian.com/uk/rss" "https://www.theregister.co.uk/headlines.atom" ] return items.[start .. min (start + qty) (Array.length items - 1)] } // If there aren't enough items to provide "qty", send a smaller slice instead of failing let webApp = let server = { getItems = getItems } remoting server { use_route_builder Route.builder } let app = application { url ("http://0.0.0.0:" + port.ToString() + "/") router webApp memory_cache use_static publicPath // sitemap diagnostic data cannot be inferred when using Fable.Remoting // Saturn issue at https://github.com/SaturnFramework/Saturn/issues/64 disable_diagnostics use_gzip } run app