What is a REST API?
Answer
A REST API (Representational State Transfer) is an architectural style for building web services that communicate over HTTP. Key constraints: Stateless — each request contains all the information needed; the server stores no session state between requests. Resource-based — endpoints represent resources (nouns): /users, /products/42. HTTP methods as verbs: GET (read), POST (create), PUT/PATCH (update), DELETE (delete). Uniform interface — consistent resource naming and standard response formats (usually JSON). Cacheable — responses should indicate if they can be cached. Express is ideal for REST APIs because its routing maps directly to REST resource/method combinations: router.get('/', list); router.post('/', create); router.get('/:id', getOne);.