Rest API - HTTP Status Codes
Given this Express.js route handler:
What will be the HTTP status code if a client requests
app.get('/products/:id', (req, res) => {
const products = { '100': 'Laptop', '200': 'Phone' };
const product = products[req.params.id];
if (!product) {
res.status(404).send('Product not found');
} else {
res.send(product);
}
});What will be the HTTP status code if a client requests
/products/300?