Web services using HTTP verbs Day 128 of 149 ๐ Full deep-dive with code examples The Library Analogy A library with standard commands: GET a book - Receive book POST a book - Donate new book PUT a book - Replace with updated version DELETE a book - Remove from library REST APIs use the same HTTP verbs to operate on resources. HTTP Methods = CRUD Method Action Example GET Read GET /users POST Create POST /users PUT Update PUT /users/1 DELETE Delete DELETE /users/1 Real Example // Get all users const users = await fetch ( " /api/users " ); // Create user await fetch ( " /api/users " , { method : " POST " , body : JSON . stringify ({ name : " Alice " }), }); Enter fullscreen mode Exit fullscreen mode Best Practices Use nouns , not verbs ( /users not /getUsers ) Use plurals ( /products not /product ) Return proper status codes (200, 201, 404, etc.) In One Sentence REST APIs use standard HTTP methods (GET, POST, PUT, DELETE) to interact with resources identified by URLs. ๐ Enjoying these?โฆ