privateuserh commited on
Commit
c957de8
·
verified ·
1 Parent(s): ce28c4b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +24 -0
index.html CHANGED
@@ -37,6 +37,30 @@
37
  </head>
38
  <body class="bg-gray-50 font-sans text-gray-800">
39
  <script src="script.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <script>
41
  // Set the base URL for your deployed Cloudflare Worker API
42
  // *** IMPORTANT: REPLACE THIS WITH THE ACTUAL URL OF YOUR DEPLOYED CLOUDFLARE WORKER ***
 
37
  </head>
38
  <body class="bg-gray-50 font-sans text-gray-800">
39
  <script src="script.js"></script>
40
+ <script>
41
+ // ...
42
+ const BACKEND_API_BASE_URL = "/api"; // This relative path will be handled by your FastAPI proxy
43
+
44
+ // ... (rest of your frontend logic to interact with backend endpoints)
45
+ // Example:
46
+ async function fetchAllTrends() {
47
+ try {
48
+ const response = await fetch(`${BACKEND_API_BASE_URL}/trends`);
49
+ if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
50
+ const data = await response.json();
51
+ // Process data and update UI
52
+ return data;
53
+ } catch (error) {
54
+ console.error("Error fetching trends:", error);
55
+ showToast('Error fetching trends.');
56
+ return [];
57
+ }
58
+ }
59
+
60
+ // Ensure your static assets are correctly linked
61
+ // e.g., <link rel="stylesheet" href="/static/styles.css">
62
+ // <script src="/static/script.js"></script>
63
+ </script>
64
  <script>
65
  // Set the base URL for your deployed Cloudflare Worker API
66
  // *** IMPORTANT: REPLACE THIS WITH THE ACTUAL URL OF YOUR DEPLOYED CLOUDFLARE WORKER ***