Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow constructing servers from HttpRoutes #723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lindholc
Copy link
Member

@lindholc lindholc commented Oct 2, 2024

Adds a new makeServer method that accepts HttpRoutes rather than subclasses of ServiceInterface (which contain routes). This allows us to manipulate the routes to enable auth without needing to change the definition of the service interface, among other things.

Prior to this commit, servers could only be constructed using
subclasses of ServiceInterface, which contain HttpRoutes. It would be
useful for the auth use case to be able to manipulate these routes,
but as written there was no way to do this. This commit gives us a way
to manipulate routes from a service interface before using them to
build a server.
@lindholc lindholc requested a review from dlindhol October 2, 2024 15:04
@@ -52,6 +52,7 @@ object Latis3ServerBuilder {

def defaultLandingPage: LandingPage = new DefaultLandingPage(makeServiceInfo("latis.util.BuildInfo$"))

@annotation.targetName("mkServerOld")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new to me. What is the motivation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two mkServer methods, but the types after erasure are the same (the interfaces argument) so there needs to be another way to disambiguate.

https://docs.scala-lang.org/scala3/reference/other-new-features/targetName.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants