A scala HTTP server & client library.
Servers and clients are service functions. A service takes an HTTP request and eventually returns an HTTP response. Requests and responses are a set of HTTP headers along with a content body. The content body is a lazy stream of bytes based on fs2, making it easy to handle streaming scenarios if needed. For additional convenience, the library provides content encoders and decoders for the common scala types. All concepts are shared between servers and clients, making it simple to compose them. SSL is supported on both sides.
The library is cross-built for Scala 2.11 and Scala 2.12.
The core module to use is "com.criteo.lolhttp" %% "lolhttp" % "0.6.1"
.
There are also 2 optional companion libraries:
"com.criteo.lolhttp" %% "loljson" % "0.6.1"
, provides integration with the circe JSON library."com.criteo.lolhttp" %% "lolhtml" % "0.6.1"
, provides minimal HTML templating.
The API documentation is the main reference. If you need to access the underlying content stream, you should first have a look a the fs2 documentation to understand the basics.
For those who prefer documentation by example, you can also follow these hands-on introductions:
- Hello world!
- Serving files from classpath.
- A Github API client.
- A JSON web service.
- Reading large request streams.
- A simple reverse proxy.
This project is licensed under the Apache 2.0 license.
Copyright © Criteo, 2017.