Skip to content

Commit 26cb0a0

Browse files
committed
[aws-serverless-example] Add example for usage of Native LambdaApi
1 parent 0956525 commit 26cb0a0

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

build.sbt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,10 @@ lazy val awsExamples: ProjectMatrix = (projectMatrix in file("serverless/aws/exa
16461646
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
16471647
)
16481648
)
1649+
.nativePlatform(
1650+
scalaVersions = scala2Versions,
1651+
settings = commonNativeSettings
1652+
)
16491653
.dependsOn(awsLambda)
16501654

16511655
lazy val awsExamples2_12 = awsExamples.jvm(scala2_12).dependsOn(awsSam.jvm(scala2_12), awsTerraform.jvm(scala2_12), awsCdk.jvm(scala2_12))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package sttp.tapir.serverless.aws.examples
2+
3+
import cats.effect.IO
4+
import cats.syntax.all._
5+
import sttp.tapir._
6+
import sttp.tapir.server.ServerEndpoint
7+
import sttp.tapir.serverless.aws.lambda.runtime._
8+
9+
object LambdaRuntime extends AwsLambdaIORuntime {
10+
val helloEndpoint: ServerEndpoint[Any, IO] = endpoint.get
11+
.in("api" / "hello")
12+
.out(stringBody)
13+
.serverLogic { _ => IO.pure(s"Hello!".asRight[Unit]) }
14+
15+
override val endpoints = Seq(helloEndpoint)
16+
}

0 commit comments

Comments
 (0)