Showing posts from August, 2015

Single page app with WebSharper UI.Next and Bootstrap

Single page application in F# with WebSharper UI.NextLast week I wrote a post on how I handle latency and exception while interacting with REST api in F# using computation expression and WebSharper. The first part on computation expression was quite detailed but the second part on WebSharper was mostly code snippets with very little explanations. Today I want to rectify that by showing you how I am using WebSharper UI.Next to build a simplistic single page application (SPA).Here is the result of what we will do: In this post I will explain few points which were hard for me to grasp when I started to code in F# with WebSharper. By writing this post, I hope that it will help you and that you won’t need to go through the same flip table phase as I did! So put on your seat belt and enjoy the ride.In this post I will explain to you:The basic of UI.Next in order for you to be able to understand the codeHow I manage routing for the SPAHow I split my webapp and organize my codeHow to put ever…

Computation Expression Approach For Calling Rest Api

Computation expression approach for calling REST APIIn this post, I will share with you how I handle latency and exception for Ajax calls from a front-end Single page application built in F# with WebSharper. The code is inspired by @ScottWlaschin blog post I will not explain what is a computation expression, for that you can refer to fsharpforfunandprofit computation expressions tutorial and I will not explain how to use WebSharper and UI.Next, for that you can refer to UI.Next samples. What I will explain here is how I combine both; to write simple code without worrying about side-effects.When interacting with REST API from a Single page application, it is a common pattern to:Get an authentication token with a Ajax callRetrieve some JSON data using the token with a Ajax call (again)Deserialize the content from JSON to your local typeWhat we would want to write is (1)letgetMyData()= let token = Api.getToken() …