""" Demo resource for the OpenEventDatabase. """ import falcon from oedb.utils.logging import logger class DemoResource: """ Resource for the demo endpoint. Handles the /demo endpoint. """ def on_get(self, req, resp): """ Handle GET requests to the /demo endpoint. Returns an HTML page with a MapLibre map showing current events. Args: req: The request object. resp: The response object. """ logger.info("Processing GET request to /demo") try: # Set content type to HTML resp.content_type = 'text/html' # Create HTML response with MapLibre map html = """ OpenEventDatabase Demo

OpenEventDatabase Demo

This map shows current events from the OpenEventDatabase.

API Endpoints:

Source Code on GitHub

""" # Set the response body and status resp.text = html resp.status = falcon.HTTP_200 logger.success("Successfully processed GET request to /demo") except Exception as e: logger.error(f"Error processing GET request to /demo: {e}") resp.status = falcon.HTTP_500 resp.text = f"Error: {str(e)}" # Create a global instance of DemoResource demo = DemoResource()