Skip to content

Commit

Permalink
Additionally mount search endpoint to /api/search/query
Browse files Browse the repository at this point in the history
This little change is meant as preparation to mount the search
endpoint in a more flexible way and to finally allow to also provide a
`/version` endpoint.

The idea is that we remove the `stripPrefix` in gateway and pass the
request as-is to the search service. The current public path should
not change, therefore it stays as `/api/search` and the current
"search" endpoint will be `/api/search/query`. Later a version
`/api/search/version` and potentially other public endpoints can be
provided as siblings. Currently it is not possible to provide more
endpoints without editing the gateway configuration (besides putting
everything under `/search` which is too strange).

This commit allows clients (UI) to use the new path for doing search
queries, while the old path is enabled as well.
  • Loading branch information
eikek committed Jun 18, 2024
1 parent 92b7f52 commit e21af66
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ final class Routes[F[_]: Async: Network](
):
private val logger = scribe.cats.effect[F]

private val prefix = "/search"

private val makeJwtVerify =
ClientBuilder(EmberClientBuilder.default[F])
.withDefaultRetry(RetryConfig.default)
Expand All @@ -71,11 +69,13 @@ final class Routes[F[_]: Async: Network](

private def searchHttpRoutes(searchRoutes: SearchRoutes[F]) =
Router[F](
prefix -> (openApiRoute(searchRoutes).routes <+> searchRoutes.routes)
"/search" -> (openApiRoute(searchRoutes).routes <+> searchRoutes.routes),
"/api/search/query" -> (openApiRoute(searchRoutes).routes <+> searchRoutes.routes),
"/search/query" -> (openApiRoute(searchRoutes).routes <+> searchRoutes.routes)
)

private def openApiRoute(searchRoutes: SearchRoutes[F]) =
OpenApiRoute[F](s"/api$prefix", "Renku Search API", searchRoutes.endpoints)
OpenApiRoute[F](s"/api/search/query", "Renku Search API", searchRoutes.endpoints)

private lazy val operationHttpRoutes =
Router[F]("/" -> OperationRoutes[F])
Expand Down

0 comments on commit e21af66

Please sign in to comment.