- Updated service template structure in `ARCHITECTURE.md` and `README.md` for clarity and usability. - Enhanced bilingual documentation across skills, increasing the number of available skills from 15 to 25. - Added new sections on event-driven architecture, inter-service communication, and performance optimization. - Improved formatting and removed outdated references to streamline the documentation experience.
1.5 KiB
1.5 KiB
name, description
| name | description |
|---|---|
| api-gateway-advanced | Advanced API Gateway patterns for GoodGo microservices including API composition, request/response transformation, service mesh integration, advanced routing, and gateway-level resilience. |
API Gateway Advanced Patterns
When to Use This Skill
Use this skill when:
- Implementing API composition and aggregation
- Transforming requests/responses at gateway level
- Integrating service mesh with Traefik
- Implementing advanced routing strategies
- Adding gateway-level circuit breakers
- Implementing API versioning at gateway
Key Patterns
API Composition
// Aggregate multiple service responses
const [user, orders, payments] = await Promise.all([
userClient.get(`/users/${userId}`),
orderClient.get(`/orders?userId=${userId}`),
paymentClient.get(`/payments?userId=${userId}`),
]);
Request/Response Transformation
// Transform at gateway level
transformer.addRule({
path: '/api/v1/users',
requestTransform: (req) => {
if (!req.query.page) req.query.page = '1';
return req;
},
responseTransform: (res, data) => {
return { success: true, data };
},
});
Best Practices
- Use API composition for aggregating related data
- Cache at gateway for frequently accessed data
- Implement circuit breaker at gateway level
- Keep transformations simple and testable
Resources
- Traefik Documentation
- Middleware Patterns
- Skill Source:
.cursor/skills/api-gateway-advanced/SKILL.md