sttp 项目使用教程

sttp 项目使用教程

sttpThe Scala HTTP client you always wanted!项目地址:https://gitcode.com/gh_mirrors/st/sttp

目录结构及介绍

sttp 项目的目录结构如下:

sttp/
├── client/
│   ├── core/
│   ├── async-http-client/
│   ├── okhttp/
│   ├── akka-http/
│   ├── http4s/
│   ├── zio/
│   ├── circe/
│   ├── json4s/
│   ├── spray-json/
│   ├── upickle/
│   ├── play-json/
│   ├── scalaz/
│   ├── monix/
│   ├── fs2/
│   ├── zio-streams/
│   ├── prometheus/
│   ├── logging/
│   ├── testing/
│   ├── examples/
│   ├── docs/
│   ├── project/
│   └── build.sbt
├── tapir/
├── model/
├── shared/
├── apispec/
├── third-party/
├── project/
├── docs/
├── build.sbt
├── README.md
└── LICENSE

主要目录介绍

  • client/: 包含 sttp 客户端的核心代码和各种后端实现。

    • core/: 核心库,定义了基本的 HTTP 请求和响应处理。
    • async-http-client/: 基于 AsyncHttpClient 的后端实现。
    • okhttp/: 基于 OkHttp 的后端实现。
    • akka-http/: 基于 Akka HTTP 的后端实现。
    • http4s/: 基于 Http4s 的后端实现。
    • zio/: 基于 ZIO 的后端实现。
    • circe/: 与 Circe JSON 库的集成。
    • json4s/: 与 Json4s JSON 库的集成。
    • spray-json/: 与 Spray JSON 库的集成。
    • upickle/: 与 uPickle JSON 库的集成。
    • play-json/: 与 Play JSON 库的集成。
    • scalaz/: 与 Scalaz 库的集成。
    • monix/: 与 Monix 库的集成。
    • fs2/: 与 FS2 库的集成。
    • zio-streams/: 与 ZIO Streams 库的集成。
    • prometheus/: 与 Prometheus 监控的集成。
    • logging/: 日志集成。
    • testing/: 测试相关代码。
    • examples/: 示例代码。
    • docs/: 文档。
    • project/: 项目配置文件。
    • build.sbt: 项目构建文件。
  • tapir/: 类型安全的 API 描述库。

  • model/: 简单的 HTTP 模型类。

  • shared/: 共享的 WebSocket、FP 抽象、能力和流代码。

  • apispec/: OpenAPI、AsyncAPI 和 JSON Schema 模型。

  • third-party/: 第三方项目。

  • project/: 项目配置文件。

  • docs/: 文档。

  • build.sbt: 项目构建文件。

  • README.md: 项目介绍和使用说明。

  • LICENSE: 项目许可证。

项目的启动文件介绍

sttp 项目的启动文件主要是 build.sbt 和各个模块的 Main.scala 文件。

build.sbt

build.sbt 文件是 SBT 项目的构建文件,定义了项目的依赖、版本、插件等信息。以下是一个简化的示例:

name := "sttp"

version := "3.0.0"

scalaVersion := "2.13.4"

libraryDependencies ++= Seq(
  "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M17",
  "com.softwaremill.sttp.client4" %% "async-http-client-backend-zio" % "4.0.0-M17",
  "com.softwaremill.sttp.client4" %% "circe" % "4.0.0-M17"
)

Main.scala

各个模块的 Main.scala 文件定义了该模块的

sttpThe Scala HTTP client you always wanted!项目地址:https://gitcode.com/gh_mirrors/st/sttp

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

高崴功Victorious

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值