Grokking ExpressJS
Vote

0% completed

​

Debugging Express.js Applications

The task with id 1 exists, yet this route answers that it does not:

const tasks = [ { id: 1, title: 'Write tests', done: false }, { id: 2, title: 'Read the Express 5 migration guide', done: true }, ]; app.get('/tasks/:id', (req, res) => { const task = tasks.find((t) => t.id === req.params.id); if (!task) { return res.status(404).json({ error: 'Task not found' }); } res.json(task); });
GET /tasks/1 HTTP/1.1 HTTP/1.1 404 Not Found Content-Type: application/json; charset=utf-8 {"error":"Task not found"}

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content