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.

Generalize middlewares

See original GitHub issue

Most of our middlewares could be more parametric.

  • By expanding HttpRoutes with Http[F, G], the same middleware can be applied to either HttpRoutes or HttpApp.
  • By expanding Http[F, G] to either Kleisli[F, Request[G], B] or Kleisli[F, A, Response[G]], middleware that only affects one side can compose with Kleislis of different outputs or inputs. The latter is particularly helpful for applying the same middleware to both regular and authorized HTTP functions.
  • Increased parametricity makes it more clear what the middleware can do from the type alone.

This is a mostly mechanical translation, and would make a great first issue for anyone looking to better understand type classes and constraints. If you claim a middleware and offer to submit a PR, I will help you if you get stuck.

Server:

  • AutoSlash.scala
  • ChunkAggregator.scala
  • CORS.scala
  • CSRF.scala
  • DefaultHead.scala
  • EntityLimiter.scala
  • GZip.scala
  • HSTS.scala
  • Jsonp.scala
  • Logger.scala
  • PushSupport.scala
  • RequestLogger.scala
  • ResponseLogger.scala
  • Timeout.scala
  • URITranslation.scala
  • UrlFormLifter.scala
  • VirtualHost.scala

Client:

  • FollowRedirect.scala
  • Logger.scala
  • package.scala
  • RequestLogger.scala
  • ResponseLogger.scala
  • Retry.scala

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
rossabakercommented, Jun 6, 2018

Alright, then I think we’re done here.

I’m very happy about the response we got. Thanks to all who jumped in. We’ll try to make better use of the first-issue tag and continue this momentum with new contributors.

1reaction
rossabakercommented, Jun 6, 2018

On further thought, I don’t think there’s anything to do on the client in the current design. The server ones are a function of Kleisli to Kleisli, and we can be generic in any of its three parameters. A Client only has one free parameter, and we’re already polymorphic on that.

If we proceed with @ChristopherDavenport’s idea of a Client being just a Kleisli, then there’s something to do. Until then, I think we’re done here.

Am I talking nonsense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modules of Generalized Middleware and their Inter Modules of...
Our proposed LBS-Middleware acquires the features of generalized middleware such as interoperability, portability, scalability and so on. ... ... A reasonable ...
Read more >
Generalizable Middleware to Support Use of REDCap ...
Although DDP is a standard module in REDCap, institutions must develop custom middleware web services to exchange data between REDCap …
Read more >
A generalized approach to real-time, non-intrusive ...
Based on the questions above, we developed a generalized approach for non-intrusive instrumentation of distributed middleware. The approach is realized in a ...
Read more >
A middleware for parallel generalized eigenvalue solvers to ...
An open-source middleware EigenKernel was developed for use with parallel generalized eigenvalue solvers or large-scale electronic state ...
Read more >
Use specific middleware in Express for all paths except a ...
Is there a generalization of braided monoidal category without the isomorphism requirement? A robust version of "a holomorphic function is determined by its ......
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