api-endpoint-pattern

Standardize Echo framework HTTP API endpoint patterns with Bind signatures and domain router placement.

1|1|Updated Dec 16, 2023
One-click install
npx skills add https://github.com/sjtw/tarkov-build-optimiser --skill api-endpoint-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-endpoint-pattern
Source: https://github.com/sjtw/tarkov-build-optimiser/tree/main/.cursor/skills/api-endpoint-pattern
Command: npx skills add https://github.com/sjtw/tarkov-build-optimiser --skill api-endpoint-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes and standardizes HTTP API endpoint patterns for the Echo framework, reducing boilerplate and inconsistencies.

Core Features & Use Cases

  • Bind pattern for domain routers to encapsulate routes and dependencies.
  • Dependency injection via Bind function to pass services like databases or configs.
  • Domain routing guidelines to keep handlers organized and reusable.

Quick Start

Implement a Bind(e *echo.Group, db *sql.DB) *echo.Group for your domain and register it in the main router.

Frequently Asked Questions about api-endpoint-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize API endpoint patterns in Echo?

Standardize API endpoint patterns in Echo by implementing a Bind function that encapsulates routes and dependencies. This enforces consistent routing and Bind usage across domain handlers, reducing boilerplate and inconsistencies.

How do I inject dependencies into Echo domain routers?

Inject dependencies into Echo domain routers by passing services like databases or configs through the Bind function. This function signature accepts the echo.Group and dependencies, attaching them directly to the router.

What is the best way to organize HTTP routes in a Go Echo backend?

The best way to organize HTTP routes in a Go Echo backend is using domain routing guidelines. Implement domain-specific Bind functions to keep handlers organized, reusable, and consistently registered within the internal router code.

Why should I use a Bind pattern for Echo framework routing?

You should use a Bind pattern for Echo framework routing to centralize endpoint standardization. It enforces a specific signature for domain routers, ensuring consistent dependency injection and routing while reducing boilerplate code.

Do I need to modify the main router when adding new domain endpoints in Echo?

Yes, when adding new domain endpoints in Echo, you must register the domain's Bind function within the main router. This ensures the standardized domain router and its encapsulated routes are correctly mounted.