I have created two Http4s
routes:
class FirstRoutes[F[_] : Async](service: FirstService[F]) extends Http4sDsl[F] {
def routes: HttpRoutes[F] = HttpRoutes.of[F] {
//... some code
}
}
class SecondRoutes[F[_] : Async] extends Http4sDsl[F] {
def routes: HttpRoutes[F] = HttpRoutes.of[F] {
//... some code
}
}
Now in my main
method I would like to call this routes like this:
override def run(args: List[String]): IO[ExitCode] =
for {
_ <- {
val app = {
//...
val firstRoutes = new FirstRoutes[F](someService)
val secondRoutes = new SecondRoutes[F]
(firstRoutes.routes <+> secondRoutes.routes).orNotFound
}
But when I compile this code I got an error:
Error:(26, 33) value <+> is not a member of org.http4s.HttpRoutes[Server.F]
(firstRoutes.routes <+> secondRoutes.routes).orNotFound
It is strange for me, because I can normally use this <+>
symbol when I use ctrl+space on route class and also I have good imports:
import cats.effect._
import cats.data._
import org.http4s.server.blaze.BlazeServerBuilder
import cats.effect._
import cats.implicits._
Cannot find out how to fix this and use <+>
to call route classes. Maybe it is intellij problem? Can someone help me?