CRUD means Create, Read, Update, and Delete. These operations form the core of many database-backed APIs.
Important security rule
Use parameterized queries. Never concatenate untrusted user input directly into SQL because that can lead to SQL injection.
Deep dive
SQL injection prevention
Never build SQL by concatenating user input. Parameterized queries keep SQL structure separate from values.
CRUD API example
- Create: POST /users
- Read: GET /users and GET /users/:id
- Update: PATCH /users/:id
- Delete: DELETE /users/:id