meals.ts
1 import { getMealsFromForDate } from "crous-mobile"; 2 3 // Get the meals for today. 4 const meals = await getMealsFromForDate("limoges", "r211", new Date()); 5 6 if (!meals) { 7 console.log("Meals data is unavailable for the given date."); 8 } 9 else if (meals.length === 0) { 10 console.log("No meals for today."); 11 } 12 else { 13 console.log("Meals:"); 14 for (const meal of meals) { 15 console.log(`- ${meal.moment} (${meal.information ?? "No information"})`); 16 for (const category of meal.categories) { 17 console.log(` - ${category.name}: ${category.dishes.join(", ")}`); 18 } 19 } 20 }