## Summary - Added redirect from `/` to `/v0/swagger/index.html` to help contributors quickly access API documentation - Implemented the redirect in router.go after v0 routes registration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
25 lines
738 B
Go
25 lines
738 B
Go
// Package router contains API routing logic
|
|
package router
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/modelcontextprotocol/registry/internal/auth"
|
|
"github.com/modelcontextprotocol/registry/internal/config"
|
|
"github.com/modelcontextprotocol/registry/internal/service"
|
|
)
|
|
|
|
// New creates a new router with all API versions registered
|
|
func New(cfg *config.Config, registry service.RegistryService, authService auth.Service) *http.ServeMux {
|
|
mux := http.NewServeMux()
|
|
|
|
// Register routes for all API versions
|
|
RegisterV0Routes(mux, cfg, registry, authService)
|
|
|
|
// Redirect root to Swagger UI
|
|
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
http.Redirect(w, r, "/v0/swagger/index.html", http.StatusFound)
|
|
})
|
|
|
|
return mux
|
|
}
|