Skip to content

Latest commit

 

History

42 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

router

CI CodeQL Coverage Mutation Documentation Go Reference Release Go License

router is an explicit, immutable HTTP router built on Go's net/http programming model. It adds deterministic composition, groups, names, safe URL generation, metadata, introspection, mounts, and route-scoped middleware while keeping handlers as ordinary http.Handler values.

The minimum supported toolchain is Go 1.26.6. The package has no runtime dependencies and no global router, reflection discovery, controller resolver, container, session, template, or application lifecycle.

See the versioned Golib ecosystem index and its service-edge package guidance for the shared design language and related packages.

Five-minute start

builder := router.New()
err := builder.Register(router.Route{
    Name:    "users.show",
    Methods: []string{http.MethodGet},
    Path:    "/users/{id}",
    Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprint(w, r.PathValue("id"))
    }),
})
if err != nil {
    return err
}

handler, err := builder.Compile()
if err != nil {
    return err
}
return http.ListenAndServe(":8080", handler)

Registration is single-owner and startup-time. The compiled router is an immutable http.Handler safe for concurrent serving and introspection.

Contracts

Development

Run make check for the blocking local checks. NilAway remains visible as an advisory result in the shared contract. Each target is independently reproducible.

Run make cohesion to validate this module's catalog classification, ownership contract, documentation entry points, and ecosystem navigation. Run make ci for the complete local contract, including online specification source validation.

License

MIT. See LICENSE and NOTICE.

Documentation

Use the documentation index for package-owned guides, operational contracts, examples, and maintainer references.

About

Inspectable net/http routing with groups, names, metadata, and no hidden magic.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages