Skip to content

How do I upgrade .compile and .toService to finch 0.34? #1632

Answered by ComFreek
ComFreek asked this question in Q&A
Discussion options

You must be logged in to vote

Perfect! It works now.
For future visitors, this is the final version of the code that's working:

class ServerState { /* ... */ }

object MyApp extends IOApp {
  override def run(args: List[String]): IO[ExitCode] = {
    val state = new ServerState(/* some initialization */)
    createService(state).useForever.as(ExitCode.Success)
  }

  private def createService(state: ServerState) = {
      Bootstrap[IO]
        .serve[Application.Json](getEndpoints(state))
        .middleware(Function.chain(Seq(/* ... */)) // e.g., logging, authentication
        .listen(":8085")
  }

  private def getEndpoints(state: ServerState) = foo :+: bar :+: /* ... */
}

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@joroKr21
Comment options

@ComFreek
Comment options

@joroKr21
Comment options

@ComFreek
Comment options

Answer selected by ComFreek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1630 on August 08, 2023 05:14.