Finch is a thin layer of purely functional basic blocks atop of Finagle for building composable REST APIs. Its mission is to provide the developers simple and robust REST API building blocks being as close as possible to the Finagle bare metal API.
Finch uses multi-project structure and contains of the following modules:
finch-core
- the core classes/functionsfinch-json
- the lightweight and immutable JSON APIfinch-demo
- the demo projectfinch-jawn
- the JSON API support for the Jawn libraryfinch-argonaut
- the JSON API support for the Argonaut library
Every Finch module is published at Maven Central. Use the following sbt snippet ...
- for the stable release:
libraryDependencies ++= Seq(
"com.github.finagle" %% "finch-module" % "0.3.0"
)
- for the
SNAPSHOT
version:
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)
libraryDependencies ++= Seq(
"com.github.finagle" %% "finch-module" % "0.4.0-SNAPSHOT" changing()
)
This quick start example is built with the 0.4.0-SNAPSHOT
version of both finch-core
and finch-json
.
def hello(name: String) = new Service[HttpRequest, HttpResponse] {
def apply(req: HttpRequest) = for {
title <- OptionalParam("title")(req)
} yield Ok(Json.obj("greetings" -> s"Hello, ${title.getOrElse("")} $name!"))
}
val endpoint = Endpoint[HttpRequest, HttpResponse] {
// routes requests like '/hello/Bob?title=Mr.'
case Method.Get -> Root / "hello" / name => hello(name)
}
}
Documentation may be found in the docs.md
file in the root directory.
- Konfettin
- JusBrasil
- Sabre Labs
- Submit a pull-request to include your company/project into the list
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.