টিডপট

const express = require('express'); const app = express(); const bodyParser = require('body-parser'); const tasks = [ { id: 1, title: 'Invest in Stock A', description: 'Buy 10 shares of Stock A.' }, { id: 2, title: 'Invest in Crypto B', description: 'Purchase 5 units of Crypto B.' } ]; app.use(bodyParser.json()); // API to get tasks app.get('/api/tasks', (req, res) => { res.json(tasks); }); // API to complete a task app.post('/api/complete-task', (req, res) => { const taskId = req.body.taskId; // Here you would update the task as completed in your database res.json({ message: 'Task completed successfully!' }); }); app.listen(3000, () => { console.log('Server is running on port 3000'); });

Comments