文件名称:Scala的HTTP服务接口http4s.zip
文件大小:1.84MB
文件格式:ZIP
更新时间:2022-08-06 00:29:10
开源项目
http4s 是一个小型的 Scala 接口,用于处理 HTTP 服务。相当于 Ruby 的 Rack、Python 的 WSGI、Haskell 的 WAI 和 Java 的 Servlet。 示例代码: // Make your model safe and streaming by using a scalaz-stream Process def getData(req: Request): Process[Task, String] = ??? val service: HttpService = { // Wire your data into your service case GET -> Root / "streaming" => Ok(getData(req)) // You can use helpers to send any type of data with an available Writable[T] case GET -> Root / "synchronous" => Ok("This is good to go right now.") } 标签:http4s