-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[aws-serverless-example] Add example for usage of Native AwsIORuntime
- Loading branch information
1 parent
0956525
commit 9021fe0
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...s/examples/src/main/scalanative/sttp/tapir/serverless/aws/examples/LambdaApiExample.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |