Dnevni recept: tabela daily_recipes, API /api/recipes, prikaz na /rezepte
This commit is contained in:
@@ -4,6 +4,7 @@ import { storage } from "./storage";
|
||||
import { insertArticleSchema } from "@shared/schema";
|
||||
import { seedDatabase } from "./seed";
|
||||
import { generateDailyHoroscopes, getHoroscopesForToday, getOrGenerateHoroscope, setHoroscopeImages } from "./horoscope-generator";
|
||||
import { getRecipeForToday, upsertRecipe } from "./daily-recipe";
|
||||
import { startDailyScheduler } from "./scheduler";
|
||||
import { analyzeAllArticleImages, getCachedFocalPoints } from "./focal-point";
|
||||
import { optimizeImage } from "./image-optimizer";
|
||||
@@ -754,6 +755,26 @@ export async function registerRoutes(
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/recipes/today", async (_req, res) => {
|
||||
try {
|
||||
const recipe = await getRecipeForToday();
|
||||
res.json(recipe);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/api/recipes", requireApiKey, async (req, res) => {
|
||||
try {
|
||||
const { name } = req.body || {};
|
||||
if (!name) return res.status(400).json({ message: "name ist erforderlich" });
|
||||
const row = await upsertRecipe(req.body);
|
||||
res.json(row);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/horoscopes/today", async (_req, res) => {
|
||||
try {
|
||||
const horoscopes = await getHoroscopesForToday();
|
||||
|
||||
Reference in New Issue
Block a user