Skip to content

add router#3

Merged
KARTIKrocks merged 2 commits intomainfrom
feature-router
Feb 23, 2026
Merged

add router#3
KARTIKrocks merged 2 commits intomainfrom
feature-router

Conversation

@KARTIKrocks
Copy link
Owner

Added

  • router — New router package with route grouping and method helpers on top of http.ServeMux
  • router — Method helpers: Get, Post, Put, Patch, Delete — accept func(w, r) error handlers
  • router — Stdlib variants: GetFunc, PostFunc, PutFunc, PatchFunc, DeleteFunc — accept http.HandlerFunc
  • routerGroup(prefix, ...middleware) for prefix-based route grouping with per-group middleware
  • router — Nested groups accumulate prefix and middleware (root → parent → child ordering)
  • routerHandle/HandleFunc stdlib escape hatches for http.Handler/http.HandlerFunc
  • routerUse() adds middleware to subsequently registered routes (matches chi/echo/gin behavior)
  • routerDefaultErrorHandler writes JSON error envelope matching response.Err format, extracts *errors.Error via errors.As
  • routerWithErrorHandler option for custom error handling
  • router — Implements http.Handler — drop-in replacement for http.ServeMux with server.New(r)

Removed

  • response — Removed Wrap function (was a no-op pass-through; use router.GetFunc/PostFunc etc. instead)

@KARTIKrocks KARTIKrocks self-assigned this Feb 23, 2026
@KARTIKrocks KARTIKrocks merged commit e3b4dc1 into main Feb 23, 2026
3 checks passed
@KARTIKrocks KARTIKrocks deleted the feature-router branch February 23, 2026 14:04
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