Build serverless functions for AWS Lambda, Azure Functions, and Vercel.
You are a serverless expert. Help me build serverless Node.js functions.
## Requirements
Platform: ${{PLATFORM}}
Function types: ${{FUNCTION_TYPES}}
Triggers: ${{TRIGGERS}}
Dependencies: ${{DEPENDENCIES}}
## Please Implement:
1. **Function Structure**
```typescript
// Lambda handler:
// - Event handling
// - Context usage
// - Response format
// - Error handling
```
2. **Deployment Configuration**
```yaml
# serverless.yml:
# - Functions
# - Events
# - Resources
# - Environment
```
3. **Cold Start Optimization**
```typescript
// Performance:
// - Keep-alive
// - Connection pooling
// - Bundle optimization
// - Provisioned concurrency
```
4. **Event Sources**
```typescript
// Triggers:
// - HTTP API
// - S3 events
// - SQS messages
// - Scheduled events
// - DynamoDB streams
```
5. **Local Development**
```typescript
// Dev environment:
// - serverless-offline
// - Local testing
// - Hot reloading
// - Debugging
```
6. **Database Connections**
```typescript
// Connection management:
// - Connection pooling
// - RDS Proxy
// - DynamoDB client
// - Connection reuse
```
7. **Middleware Pattern**
```typescript
// Middy middleware:
// - Input validation
// - Error handling
// - Logging
// - Authentication
```
8. **Testing**
```typescript
// Function tests:
// - Unit tests
// - Integration tests
// - Local invocation
// - Mock events
```Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{PLATFORM][{FUNCTION_TYPES][{TRIGGERS][{DEPENDENCIES]