I am trying to create a post endpoint for a particular route but am getting the error message
Pattern type is incompatible with expected type found ContextRequest[F,A], required: Request[F]
case _ @ POST -> Root / "batch-notify" as _ =>
handler.handle("create.notifications.batchNotify") {
for {
_ <- log.info("Running batch notification job") *> Sync[F].pure(())
r <- batchingService.createNotifications.flatMap(_ => Ok())
} yield r
}.fireAndForget.flatMap(_ => Accepted())
I'm quite new to Scala and have tried fixing it but getting nowhere, would anyone be able to help?
aka
aka
is an
AuthedRequestused forAuthedRouteshttps://http4s.org/v1/docs/auth.html
If you put it into a pattern matching where
Requestis expected forHttpRoutes(i.e. without authentication)https://http4s.org/v1/docs/service.html
then you'll have a compile error
You can find example how to combine
AuthedRouteswithHttpRoutesat https://http4s.org/v1/docs/auth.html#composing-authenticated-routes