Skip to content

Added Chi Routing, API Stubs#12

Merged
Howard-nolan merged 1 commit intomainfrom
feature/better_routing
Nov 10, 2025
Merged

Added Chi Routing, API Stubs#12
Howard-nolan merged 1 commit intomainfrom
feature/better_routing

Conversation

@Howard-nolan
Copy link
Owner

Change Summary:

  • Added Chi router setup to handle API routes.
  • Created stub handlers for /v1/r/{code} and /v1/shorten endpoints to prepare for future URL redirection and shortening logic.
  • This sets the foundation for versioned API routing and future OpenAPI documentation integration.

How It Works:

  • The server now initializes a Chi router in main.go, registering routes under /v1/.
  • GET /v1/r/{code} will later handle redirecting a short code to its target URL.
  • POST /v1/shorten will accept a long URL in the request body and return a shortened code.
  • Both endpoints currently return placeholder JSON responses to confirm routing is functional.

Additional Notes (optional):

  • Future work: implement persistence layer for shortened URLs (e.g., MongoDB, Redis).
  • Can easily extend versioning by adding additional route groups (e.g., /v2/).
  • No functional logic yet—this MR only sets up routing and scaffolding.

@Howard-nolan Howard-nolan merged commit 9dc51eb into main Nov 10, 2025
1 check passed
github-actions bot added a commit that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant