Page 35 - MSDN Magazine, October 2019
P. 35

Figure 7 Unified Client and Server Debugging
as well as an Azure Storage-type provider that makes access to your Azure Storage data incredibly easy. If you want Docker or GCP support, that’s included out-of-the-box, as well. Figure 6 shows a sample search application using Azure Search and Storage and is hosted on the Azure App Service.
Extensible model: SAFE is more than just a bundled “package” of different technologies; there’s a growing ecosystem around it, including libraries that allow seamless client-server interaction through contracts, reactive push-based messaging libraries and WebSocket abstractions.
SAFE is more than just a bundled “package” of different technologies; there’s a growing ecosystem around it.
Debugging support: SAFE changes how you work with F# Web applications. On the server you can use tools like dotnet watch to provide a rapid loop for code changes, but client apps go one step further and take advantage of hot module reloading to allow you to make changes to running applications without restarting, at all! And, thanks to some of the smarts of Fable and the JavaScript community, you can even debug both the client and server of your application directly from a single IDE—setting breakpoints and viewing stack traces across both .NET and JavaScript runtimes, both in F#.
Getting Started with SAFE
How do you get started? Here are a few options to get going:
msdnmagazine.com
The SAFE Template If you want to dive right in and create a new “empty” SAFE app today, there’s a full dotnet project template that has all the bells and whistles, such as generation of ARM tem- plates for Azure, Docker support and so on. There are a couple of prerequisites (bit.ly/2Z8fg0k), but once they’re taken care of you can create a new SAFE app like so:
dotnet new -i SAFE.Template dotnet new SAFE
Open the folder with VS Code, go to the Debug panel, select Debug SAFE App and press F5. After a short delay while all the JavaScript dependencies are downloaded, a basic SAFE applica- tion will start in a Chrome instance.
Youcannowexperimentwiththeapplication,creatingbreakpoints using F9 or clicking in the gutter. Check out how in Figure 7 the counter value in the Local panel shows the value of the counter (42).
Try the SAFE Dojo You’ll find an introductory “dojo” exercise at bit.ly/2TNcixh that introduces you to the different components, starting from a slightly larger “shell” of an application and a set of exercises that you need to complete. It’s takes around 60 to 90 minutes and is well worth doing.
Find out More There’s also a comprehensive set of documen- tation and guidance on the SAFE homepage, safe-stack.github.io/docs. From there, you can find user group talks in an area near you; contact the team through social media; and ask questions or reach out to one of the professional organizations that offer SAFE Stack training and consulting.
I hope this article has you excited and interested in trying out both F# and the SAFE Stack—have fun! n
Isaac abraham is a .NET developer, trainer and the director of Compositional IT. He’s also a Microsoft MVP for his contributions to functional programming and the cloud.
Thanks to the following Microsoft technical expert for reviewing this article: Phillip Carter
October 2019 31

















































































   33   34   35   36   37