@@ -165,6 +165,8 @@ def __init__( # noqa: PLR0915
165165 self .route ("/tileserver/tap_query/<x>/<y>" )(self .tap_query )
166166 self .route ("/tileserver/prop_range" , methods = ["PUT" ])(self .prop_range )
167167 self .route ("/tileserver/shutdown" , methods = ["POST" ])(self .shutdown )
168+ self .route ("/tileserver/sessions" , methods = ["GET" ])(self .sessions )
169+ self .route ("/tileserver/healthcheck" , methods = ["GET" ])(self .healthcheck )
168170
169171 def _get_session_id (self : TileServer ) -> str :
170172 """Get the session_id from the request.
@@ -718,6 +720,30 @@ def prop_range(self: TileServer) -> str:
718720 self .renderers [session_id ].score_fn = lambda x : (x - minv ) / (maxv - minv )
719721 return "done"
720722
723+ def sessions (self : TileServer ) -> Response :
724+ """Retrieve a mapping of session keys to their corresponding slide file paths.
725+
726+ Returns:
727+ Response: A JSON response containing a mapping of session keys
728+ and their respective slide file paths.
729+ """
730+ session_paths = {}
731+ for key , layer in self .layers .items ():
732+ session_paths [key ] = str (layer .get ("slide" ).info .as_dict ()["file_path" ])
733+
734+ return jsonify (session_paths )
735+
736+ def healthcheck (self : TileServer ) -> Response :
737+ """Simple health check endpoint to verify the server is running.
738+
739+ Useful for load balancers or uptime monitoring tools to check
740+ if the service is operational.
741+
742+ Returns:
743+ Response: A JSON response with status "OK" and HTTP status code 200.
744+ """
745+ return jsonify ({"status" : "OK" })
746+
721747 @staticmethod
722748 def shutdown () -> None :
723749 """Shutdown the tileserver."""
0 commit comments