Skip to content

Instantly share code, notes, and snippets.

@adamw
Last active May 18, 2020 08:37
Show Gist options
  • Save adamw/9894ab3e968d769507997b8dd5182c03 to your computer and use it in GitHub Desktop.
Save adamw/9894ab3e968d769507997b8dd5182c03 to your computer and use it in GitHub Desktop.
import sttp.tapir.json.circe._
import io.circe.generic.auto._
import sttp.tapir.server.PartialServerEndpoint
val error: EndpointOutput[Error] = stringBody.and(statusCode).mapTo(Error)
val secureEndpoint: PartialServerEndpoint[User, Unit, Error, Unit, Nothing, IO] =
endpoint
.in(auth.bearer[String].mapTo(AuthToken))
.in("api" / "1.0")
.errorOut(error)
.serverLogicForCurrent(authorize)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment