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.
Select creating a standalone project

Select a Suave application

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.

Wow, your project is now created!
CD into the project directory and run VS Code.

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

Ok, it gives us some hope. Open the terminal with CTRL+`, cd to build folder and run the build result.

Ok, it waits for the connections on 8083 port at localhost. Let’s inspect it.

Congratulations! Next time we’ll learn how to use Paket and will build a basic restful service with Suave.
Комментариев нет:
Отправка комментария