question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create HttpApp and HttpRoutes Defaults for Server Middleware

See original GitHub issue

Server Middleware that is defined on Http[F, G] can sometimes be hard to reason about for folks who are trying to get a handle on the Http process. Rather than forcing individuals to learn Kleisli Composition, and FunctionK, we can create function which summon that middleware on HttpRoutes, or HttpApp respectively with OptionT.liftK and FunctionK.id. As its just a default argument being plugged in, but will make the middleware far more approachable without losing any of the composition the get Http types give us.

So each middleware would get on that take and HttpRoutes[F], and an HttpApp[F], preferably names def httpRoutes and def httpApp

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rossabakercommented, Jun 10, 2020

Apologies, I’ve been drowning in notifications.

  • Agreed on MonoidK.
  • Agreed with putting constructors on the builders where there are builders.
  • The object seems reasonable for named constructors. It’s consistent with the majority if we think of them all as having that, with an implicit “apply”.

So, yeah, 👍.

0reactions
bplommercommented, Aug 22, 2022

In https://github.com/http4s/http4s/pull/6629 I took a different approach of adding a Lift type class that provides the FunctionK instance. That pull request also deprecates the httpApp/httpRoutes constructors - do people feel strongly about having httpApp and httpRoutes constructors in addition?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Service - http4s
This tutorial will walk you through creating your first http4s service and calling it with http4s' client. Create a new directory, with the...
Read more >
http4s/http4s - Gitter
I talk about this in my presentation at NE Scala. I guess we need to get a distilled version on the site. Remember...
Read more >
org.http4s.server.Router Scala Example - ProgramCreek.com
This page shows Scala examples of org.http4s.server. ... Root as user using traceId => Created(user -> traceId) } lazy val authMiddleware: AuthMiddleware[F, ...
Read more >
Natchez HTTP4s - OvoTech
natchez-extras-http4s provides HTTP4s Middleware to trace all HTTP requests. ... To use Natchez HTTP4s you create an HttpApp[Kleisli[F, Span[F], ...
Read more >
Running http4s server with ZIO Env - scala - Stack Overflow
Router import org.http4s.server.middleware. ... _ val httpApp: HttpApp[AppTask] = Router[AppTask]( ... /tmp/http4s/build.sbt.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found