4

I have defined the following route:

object InterestRoutes {
  def apply[F[_]: Sync](query: InterestProgram[F]): InterestRoutes[F] = new InterestRoutes[F](query)
}

final class InterestRoutes[F[_]: Sync](query: InterestProgram[F]) extends Http4sDsl[F] {
  private val path = "/interests"

  private val httpRoutes: HttpRoutes[F] = HttpRoutes.of[F] {
    case GET -> Root =>
      Ok(query.findAll.map(i => i.asJson))
  }

  def routes: HttpRoutes[F] = Router(
    path -> InterestHttpErrorHandler[F].handle(httpRoutes)
  )

}

and I have tried to compose to the parent path:

private def routes[F[_]: Sync: Timer](xa: Transactor[F]): HttpApp[F] =
    Router("/api" -> InterestRoutes(InterestProgram(LiveInterestQuery.make(xa))).routes).orNotFound

When I call the URL http://localhost:8080/api/interests, I have got Not found.

What am I doing wrong?

softshipper
  • 32,463
  • 51
  • 192
  • 400

0 Answers0