• Stars
    star
    92
  • Rank 349,327 (Top 8 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An HTTP Server and Client library for Scala.

lolhttp

An HTTP Server and Client library for Scala.

About the library

A server is built from a plain function accepting an HTTP request and eventually giving back an HTTP response. The computation is wrapped into an effect and can handle pure & impure and synchronous & asynchronous scenarios. Requests and responses are just HTTP metadata along with a lazy content body 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. Clients and Servers share the same API and the same concepts, making it easy to compose them. SSL is supported on both sides.

Hello World

// Let's start an HTTP server
Server.listen(8888) {
  case GET at "/hello" =>
    Ok("Hello World!")
  case _ =>
    NotFound
}

// Let's connect with an HTTP client
Client.runSync(Get("http://localhost:8888/hello")) { res =>
  res.readAs[String].map { contentBody =>
    println(s"Received: $contentBody")
  }
}

Usage

The library is cross-built for Scala 2.11 and Scala 2.12.

The core module to use is "com.criteo.lolhttp" %% "lolhttp" % "0.13.1".

There are also 2 optional companion libraries:

  • "com.criteo.lolhttp" %% "loljson" % "0.13.1", provides integration with the circe JSON library.
  • "com.criteo.lolhttp" %% "lolhtml" % "0.13.1", provides minimal HTML templating.

Documentation

The API documentation is the main reference.

If you never used cats effects before, you should start by having a quick look at it. Service Responses must be wrapped into an IO (although there is an implicit conversion translating Response into a pure IO if needed). Also consuming the underlying content stream data is an effect. For asynchronous scenarios you have to deal with asynchronous effects, unless you prefer working with Future and wrapping it at the end using IO.fromFuture.

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:

License

This project is licensed under the Apache 2.0 license.

Copyright

Copyright © Criteo, 2018.

More Repositories

1

autofaiss

Automatically create Faiss knn indices with the most optimal similarity search parameters.
Python
702
star
2

cassandra_exporter

Apache Cassandra® metrics exporter for Prometheus
Java
163
star
3

biggraphite

Simple Scalable Time Series Database
Python
126
star
4

babar

Profiler for large-scale distributed java applications (Spark, Scalding, MapReduce, Hive,...) on YARN.
Java
124
star
5

cuttle

An embedded job scheduler.
Scala
114
star
6

kafka-sharp

A C# Kafka driver
C#
110
star
7

kerberos-docker

Run kerberos environment in docker containers
Shell
97
star
8

tf-yarn

Train TensorFlow models on YARN in just a few lines of code!
Python
87
star
9

Spark-RSVD

Randomized SVD of large sparse matrices on Spark
Scala
77
star
10

consul-templaterb

consul-template-like with erb (ruby) template expressiveness
Ruby
74
star
11

JVips

Java wrapper for libvips using JNI.
Java
65
star
12

deepr

The deepr module provide abstractions (layers, readers, prepro, metrics, config) to help build tensorflow models on top of tf estimators
Python
50
star
13

cluster-pack

A library on top of either pex or conda-pack to make your Python code easily available on a cluster
Python
45
star
14

findjars

Gradle plugin to debug classpath issues
Kotlin
44
star
15

kafka-ganglia

Kafka Ganglia Metrics Reporter
Java
39
star
16

garmadon

Java event logs collector for hadoop and frameworks
Java
39
star
17

graphite-remote-adapter

Fully featured graphite remote adapter for Prometheus
Go
35
star
18

marathon_exporter

A Prometheus metrics exporter for the Marathon Mesos framework
Go
34
star
19

haproxy-spoe-auth

Plugin for authorizing users against LDAP
Go
30
star
20

haproxy-spoe-go

An implementation of the SPOP protocol in Go. https://www.haproxy.org/download/2.0/doc/SPOE.txt
Go
28
star
21

command-launcher

A command launcher 🚀 made with ❤️
Go
28
star
22

vizsql

Scala and SQL happy together.
Scala
27
star
23

CriteoDisplayCTR-TFOnSpark

Python
27
star
24

netcompare

Python
26
star
25

loop

enhance your web application development workflow
JavaScript
26
star
26

fromconfig

A library to instantiate any Python object from configuration files.
Python
23
star
27

netprobify

Network probing tool crafted for datacenters (but not only)
Python
22
star
28

vertica-hyperloglog

C++
22
star
29

slab

An extensible Scala framework for creating monitoring dashboards.
Scala
22
star
30

openapi-comparator

C#
20
star
31

consul-bench

A tool to bench Consul Clusters
Go
19
star
32

socco

A Scala compiler plugin to generate documentation from Scala source files.
Scala
19
star
33

mesos-term

Web terminal and sandbox explorer for your mesos containers
TypeScript
19
star
34

memcache-driver

Criteo's .NET MemCache driver
C#
16
star
35

NinjaTurtlesMutation

C#
16
star
36

vagrant-winrm

Vagrant 1.6+ plugin extending WinRM communication features
Ruby
16
star
37

mlflow-elasticsearchstore

ElasticSearch implementation of MlFlow tracking store
Python
16
star
38

defcon

DefCon - Status page and API for production status
Python
15
star
39

criteo-python-marketing-sdk

Official Python SDK to access the Criteo Marketing API
Python
15
star
40

mesos-external-container-logger

Mesos container logger module for logging to processes, backported from MESOS-6003
C++
14
star
41

lobster

Simple loop job runner
Ruby
12
star
42

android-publisher-sdk

Criteo Publisher SDK for Android
Java
11
star
43

berilia

Create hadoop cluster in aws ec2 for development
Scala
11
star
44

mlflow-yarn

Backend implementation for running MLFlow projects on Hadoop/YARN.
Python
10
star
45

openpass

TypeScript
10
star
46

ios-publisher-sdk

Criteo Publisher SDK for iOS
Objective-C
10
star
47

traffic-mirroring

Go
8
star
48

ipam-client

Python ipam-client library
Python
7
star
49

tableau-parser

Scala
7
star
50

gourde

Flask sugar for Python microservices
Python
7
star
51

criteo-java-marketing-sdk

Official Java SDK to access the Criteo Marketing API
Java
7
star
52

metrics-net

Archived: Capturing CLR and application-level metrics. So you know what's going on.
C#
6
star
53

casspoke

Prometheus probe exporter for Cassandra latency and availability
Java
6
star
54

eslint-plugin-criteo

JavaScript
6
star
55

mewpoke

Memcached / couchbase probe
Java
6
star
56

je-code-crazy-filters

Python
6
star
57

http-proxy-exporter

Expose proxy performance statistics in a Prometheus-friendly way.
Go
5
star
58

kitchen-transport-speedy

Speed up kitchen file transfer using archives
Ruby
5
star
59

newman-server

A simple webserver to run Postman collections using the newman engine
JavaScript
5
star
60

vertica-datasketch

C++
5
star
61

ocserv-exporter

ocserv exporter for Prometheus
Go
4
star
62

django-memcached-consul

Used consul discovered memcached servers
Python
4
star
63

skydive-visualizer

Go
4
star
64

log4j-jndi-jar-detector

Application trying to detect processes vulnerable to log4j JNDI exploit
Go
4
star
65

criteo-api-python-sdk

Python
4
star
66

RabbitMQHare

High-level RabbitMQ C# client
C#
4
star
67

automerge-plugin

Gerrit plugin to automatically merge reviews
Java
4
star
68

cassback

This project aims to backup Cassandra SSTables and store them into HDFS
Ruby
4
star
69

vertica-hll-druid

C++
3
star
70

hive-client

A Pure Scala/Thrift Hive Client
Thrift
3
star
71

fromconfig-mlflow

A fromconfig Launcher for MlFlow
Python
3
star
72

android-events-sdk

Java
3
star
73

rundeck-dsl

Groovy
3
star
74

tableau-maven-plugin

Java
3
star
75

android-publisher-sdk-examples

Java
3
star
76

ml-hadoop-experiment

Python
3
star
77

vault-auth-plugin-chef

Go
3
star
78

mesos-command-modules

Mesos modules running external commands
C++
3
star
79

scala-schemas

use scala classes as schema definition across different systems
Scala
3
star
80

tf-collective-all-reduce

Lightweight framework for distributed TensorFlow training based on dmlc/rabit
Python
3
star
81

criteo-marketing-sdk-generator

A Gradle project to generate custom SDKs for Criteo's marketing API
Mustache
3
star
82

s3-probe

Go
3
star
83

blackbox-prober

Go
3
star
84

kitchen-vagrant_winrm

A test-kitchen driver using vagrant-winrm
Ruby
2
star
85

graphite-dashboard-api

Graphite Dashboard API
Ruby
2
star
86

nrpe_exporter

Go
2
star
87

criteo-python-marketing-transition-sdk

Python
2
star
88

criteo-java-marketing-transition-sdk

Java
2
star
89

pgwrr

Python
2
star
90

privacy

2
star
91

knife-ssh-agent

Authenticate to a chef server using a SSH agent
Ruby
2
star
92

carbonate-utils

Utilities for carbonate - resync whisper easilly
Python
2
star
93

mesos-modules-ruby

A simple way to use ruby script as mesos modules
C++
2
star
94

ios-events-sdk

Objective-C
2
star
95

marathon-capabilities-plugin

A plugin to allow marathon to leverage mesos capabilities isolator
Scala
2
star
96

node-disruption-controller

Go
2
star
97

hardware-manifesto

Criteo's hardware operating principles manifest
2
star
98

ios-publisher-sdk-mopub-adapters

2
star
99

criteo-api-sdk-generator

A Gradle project to generate SDKs for Criteo's API
Mustache
2
star
100

android-publisher-sdk-google-adapters

Criteo Adapters for Google Mediation (Android)
Kotlin
2
star