Build an API that serves products. There's a list lookup and a single-item lookup. An existing product returns the product, and a missing id returns 404. Complete the single-product lookup. Note: GET /products returns the full list, GET /products/:id returns one product (200), 404 when missing. There are 3 products in the in-memory store and ids are numbers.
This challenge has you build a product lookup API in NestJS. There is a list endpoint (GET /products) and a single-item endpoint (GET /products/:id); you complete the single lookup so an existing product returns 200 with the product and a missing id returns 404. It uses a fixed in-memory store of three items, so you practice handling a value that arrives in the URL path.
This problem is about how an API receives a value from the URL path and turns it into a response. In a single-item lookup like /products/:id, the common contract is to return 200 with the resource when it exists and 404 when the requested identifier matches nothing. Verifying an API like this means checking more than the happy path such as the list endpoint — you also exercise a single lookup of an existing identifier and a lookup of a missing one.