If you remember playing around with MonadError, you’ll recognize the code here. We attempt to run our program and execute possible side effects via the unsafeRunSync method from Cats effect.
But to provide a proper return type for the IOApp, we need to evaluate the return value, which is either an error or a proper exit code. In case of an error, we print it out on the console (no fancy logging here) and explicitly set an error code as the return value.
Please note that we also wrap our error handler into an IO to defer possible side effects.
Like in impure implementation, we will explore the pure APIs hosted on the port 53248.
Path HTTP Method Function
/products POST Create a product
/products GET Get all products and translations
/product/{UUID} PUT Update product
/product/{UUID} GET Get the specific product
The product model looks like this: