Skip to content

Commit

Permalink
Remove exit code from examples (#2058)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr authored Dec 26, 2023
1 parent 903ff46 commit 5f74eb6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
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
}

0 comments on commit 5f74eb6

Please sign in to comment.