Created
May 7, 2019 10:11
-
-
Save Igosuki/90eafda9a46090dabeeeb1a944e6431a to your computer and use it in GitHub Desktop.
Circe - Magnolia problem example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.circe.magnolia.derivation.encoder.auto._ | |
import org.http4s.rho._ | |
import cats.implicits._ | |
import cats.effect._ | |
import com.us.repos._ | |
class AppsEndpoint[F[+ _]: Effect](appsDao: AppsRepo[F], swaggerSyntax: SwaggerSyntax[F]) extends RhoRoutes[F] { | |
import swaggerSyntax._ | |
// If appsDao.list is F[Seq[App]] then the jsonEncoder outputs '[...]' | |
// If appsDao.list is F[List[App]] aka colon::colon then the jsonEncoder outputs '{"::": [...]}' | |
"List apps" ** GET / "apps" |>> { | |
appsDao.list.flatMap(x => Ok(x)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment