Update server.js
Browse files
server.js
CHANGED
|
@@ -28,11 +28,21 @@ cron.schedule('*/15 * * * *', async () => {
|
|
| 28 |
// Example: Update current season data
|
| 29 |
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current.json`, 'currentSeason');
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
// Update additional endpoints as needed
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}drivers.json`, 'drivers');
|
| 35 |
-
|
| 36 |
// Add more endpoints to update cache as needed
|
| 37 |
});
|
| 38 |
|
|
|
|
| 28 |
// Example: Update current season data
|
| 29 |
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current.json`, 'currentSeason');
|
| 30 |
|
| 31 |
+
// Update driver standings for the current season
|
| 32 |
+
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current/driverStandings.json`, 'driverStandings-current');
|
| 33 |
+
|
| 34 |
+
// Update constructor standings for the current season
|
| 35 |
+
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current/constructorStandings.json`, 'constructorStandings-current');
|
| 36 |
+
|
| 37 |
+
// Update race results for 2024 season, rounds 1 to 24
|
| 38 |
+
for (let round = 1; round <= 24; round++) {
|
| 39 |
+
await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current/${round}/results.json`, `raceResults-2024-${round}`);
|
| 40 |
+
}
|
| 41 |
// Update additional endpoints as needed
|
| 42 |
+
// await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}current/other.json`, 'otherData');
|
| 43 |
+
// await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}seasons.json`, 'seasons');
|
| 44 |
+
//await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}drivers.json`, 'drivers');
|
| 45 |
+
// await fetchDataAndUpdateCache(`${ERGAST_API_BASE_URL}constructors.json`, 'constructors');
|
| 46 |
// Add more endpoints to update cache as needed
|
| 47 |
});
|
| 48 |
|