🔥 AI Hook Generator
Enter a topic and get viral hooks
`); }); // API app.post("/generate", async (req, res) => { const { topic } = req.body; try { const completion = await openai.chat.completions.create({ model: "gpt-4.1-mini", messages: [ { role: "system", content: "You are a viral content expert. Generate short, catchy, scroll-stopping hooks." }, { role: "user", content: \`Give me 10 viral hooks about: \${topic}\` } ], }); const text = completion.choices[0].message.content; const hooks = text.split("\\n").filter(line => line.trim() !== ""); res.json({ hooks }); } catch (err) { res.status(500).json({ error: err.message }); } }); app.listen(3000, () => { console.log("Server running on http://localhost:3000"); });
Post a Comment