Starting the Application
Explore initializing a pure functional HTTP API in Scala by setting up the database, configuring routes with http4s, and managing the application lifecycle using Cats effect IOApp. Understand how to wire components together and execute side effects safely within a functional paradigm.
We'll cover the following...
Main application
Within our main entry point, we initialize all needed components and wire them together. We’ll step through each part in this section.
The first thing you’ll notice is that we use the IOApp provided by the Cats effect library.
We need to suppress a warning from wartremover (Line 2) here as well.
Database initialization
Let’s continue to initialize the database connection.
We create our database migrator explicitly wired to the IO data type.
Now, we start with a for comprehension in which we load our ...