Skip to content

Commit

Permalink
[aws-serverless-example] Add example for usage of Native AwsIORuntime
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed May 19, 2023
1 parent 0956525 commit 9021fe0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,10 @@ lazy val awsExamples: ProjectMatrix = (projectMatrix in file("serverless/aws/exa
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
)
.nativePlatform(
scalaVersions = scala2Versions,
settings = commonNativeSettings
)
.dependsOn(awsLambda)

lazy val awsExamples2_12 = awsExamples.jvm(scala2_12).dependsOn(awsSam.jvm(scala2_12), awsTerraform.jvm(scala2_12), awsCdk.jvm(scala2_12))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package sttp.tapir.serverless.aws.examples

import cats.effect.IO
import cats.syntax.all._
import sttp.tapir._
import sttp.tapir.server.ServerEndpoint
import sttp.tapir.serverless.aws.lambda.runtime._

object LambdaRuntime extends AwsLambdaIORuntime {
val helloEndpoint: ServerEndpoint[Any, IO] = endpoint.get
.in("api" / "hello")
.out(stringBody)
.serverLogic { _ => IO.pure(s"Hello!".asRight[Unit]) }

override val endpoints = Seq(helloEndpoint)
}

0 comments on commit 9021fe0

Please sign in to comment.