Serverless computing is a cloud computing execution model where the cloud provider manages the infrastructure and automatically allocates resources based on demand.
Key characteristics:
1. **No Server Management:**
- Zero infrastructure maintenance
- Automatic scaling
- Pay-per-use billing
2. **Event-Driven:**
- Function triggers
- Automatic execution
- Stateless operations
Example AWS Lambda function:
```javascript
exports.handler = async (event) => {
try {
const result = await processEvent(event);
return {
statusCode: 200,
body: JSON.stringify(result)
};
} catch (error) {
return {
statusCode: 500,
body: JSON.stringify({ error: error.message })
};
}
};
```