Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove exit code from examples #2058

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions examples/src/main/scala/example/client/ExampleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object ExampleApp extends ZIOAppDefault {

case class Character(name: String, nicknames: List[String], origin: Origin, role: Option[Role])

override def run = {
def run = {
val character = {
import example.client.Client.Character._
(name ~
Expand Down Expand Up @@ -62,8 +62,6 @@ object ExampleApp extends ZIOAppDefault {
val call1 = sendRequest(mutation.toRequest(uri))
val call2 = sendRequest(query.toRequest(uri, useVariables = true))

(call1 *> call2)
.provideLayer(HttpClientZioBackend.layer())
.exitCode
(call1 *> call2).provideLayer(HttpClientZioBackend.layer())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ object FederatedApp extends ZIOAppDefault {
val episodeServer =
FederatedApi.Episodes.api.runServer(8089, "/api/graphql")

override def run =
def run =
(characterServer race episodeServer)
.provide(EpisodeService.make(sampleEpisodes), CharacterService.make(sampleCharacters))
.exitCode
}
3 changes: 1 addition & 2 deletions examples/src/main/scala/example/quick/AuthExampleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object Authed extends GenericSchema[Auth] {

object AuthExampleApp extends ZIOAppDefault {

override def run: URIO[Any, ExitCode] =
def run =
(for {
exampleApi <- ZIO.service[GraphQL[Any]]
handlers <- (exampleApi |+| Authed.api).handlers.map(_ @@ Auth.middleware)
Expand All @@ -78,5 +78,4 @@ object AuthExampleApp extends ZIOAppDefault {
Auth.http,
Server.defaultWithPort(8090)
)
.exitCode
}
3 changes: 1 addition & 2 deletions examples/src/main/scala/example/stitching/ExampleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ object ExampleApp extends ZIOAppDefault {

private val graphiql = Handler.fromResource("graphiql.html").sandbox

override def run =
def run =
(for {
api <- StitchingExample.api
interpreter <- api.interpreter
Expand All @@ -129,5 +129,4 @@ object ExampleApp extends ZIOAppDefault {
Configuration.fromEnvironment,
Server.default
)
.exitCode
}
6 changes: 3 additions & 3 deletions examples/src/main/scala/example/tapir/ExampleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ object ExampleApp extends CatsApp {

private implicit val network: Network[MyTask] = Network.forAsync

override def run =
(for {
def run =
for {
interpreter <- graphql.interpreter
_ <- EmberServerBuilder
.default[MyTask]
Expand All @@ -60,5 +60,5 @@ object ExampleApp extends CatsApp {
.toScopedZIO
_ <- Console.printLine("Server online at http://localhost:8088/\nPress RETURN to stop...")
_ <- Console.readLine
} yield ()).exitCode
} yield ()
}
3 changes: 1 addition & 2 deletions examples/src/main/scala/example/ziohttp/AuthExampleApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object Authed extends GenericSchema[Auth] {
object AuthExampleApp extends ZIOAppDefault {
private val graphiql = Handler.fromResource("graphiql.html").sandbox

override def run: URIO[Any, ExitCode] =
def run =
(for {
exampleApi <- ZIO.service[GraphQL[Any]]
interpreter <- (exampleApi |+| Authed.api).interpreter
Expand All @@ -107,5 +107,4 @@ object AuthExampleApp extends ZIOAppDefault {
ZLayer.succeed(Server.Config.default.port(8088)),
Server.live
)
.exitCode
}