Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
advanced-http4s
Discontinued :rainbow: Code samples of advanced features of Http4s in combination with some features of Fs2 not often seen.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I found Cask the most "lean" one of them all: https://github.com/lihaoyi/cask
I've never used it myself, but Resty may fit what you're looking for
The example uses Cats Effect, FS2 and Tagless Final.
This example uses probably the most popular JSON library for Scala, Circe. There is another Scala library that lets us "be more specific with," or "refine," our types, called Refined. http4s doesn't provide any particular support for Refined, but Circe has a module integrating Refined, meaning that all of Circe's parsing, encoding, and decoding support is integrated with Refined. Putting together http4s' Circe support, Circe's generic codec derivation, and Circe's Refined integration, here's what I came up with:
Your "file upload" question, I think, reveals more of the actual difficulties. It raises all sorts of security, resource safety, and just general design issues, e.g. how does the system handle really huge files? How should errors be handled? etc. That said, there is an example of a file upload service written by Gabriel Volpe that, once again, reveals that it's not a lot of effort to do, given some decisions about how you want to deal with the possible range of issues involved.