понедельник, 18 июля 2016 г.

Scaffolding a Suave app with Yeoman for Visual Studio code

Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.


I’ve found out that dealing with Suave is not trivial even in Visual Studio but Yeoman is here to help us. Ok, let’s see.
image
Select creating a standalone project
image
Select a Suave application
image
It will ask you for application name, provide it with some value (I’ve chose SuaveTest). Agree to use Paket and FAKE and let it make its work.
image
Wow, your project is now created!
CD into the project directory and run VS Code.
image
Let’s now build the most basic possible Suave app.
Thanks Yeoman, you’ve already done all the work for us:


You can see here the single function call startWebServer that takes web part OK with response “Hello world” as the second parameter. Let’s try to build it by pressing CTRL+F5
image
Ok, it gives us some hope. Open the terminal with CTRL+`, cd to build folder and run the build result.
image
Ok, it waits for the connections on 8083 port at localhost. Let’s inspect it.
image
Congratulations! Next time we’ll learn how to use Paket and will build a basic restful service with Suave.

Комментариев нет:

Отправить комментарий