Skip to content

tpunder/fm-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frugal Mechanic Async HTTP Client and Server

Build Status

This is our Async Http Client & Server for Scala based on Netty

Basic Server Usage

import fm.http.server.{HttpServer, RequestRouter, Response}
import fm.http.server.RouteMatchers._
import scala.concurrent.Future

val router: RequestRouter = RequestRouter{
  case GET("/") => Future.successful(Response.Ok("Home Page"))
}

val server: HttpServer = HttpServer(8080, router, "<auth_key>")

Basic Client Usage

import fm.http.client.{FullStringResponse, HttpClient, Response}
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

// Create an HttpClient with default options
val client: HttpClient = HttpClient()

val res: Future[FullStringResponse] = client.getFullString("http://localhost:8080/")

res.foreach{ r: FullStringResponse => assert(r.body == "Home Page") }

Authors

Tim Underwood (GitHub, LinkedIn, Twitter, Google Plus)

Copyright

Copyright Frugal Mechanic

License

Apache License, Version 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages