nethttp

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package nethttp is gota's Phase 1 router plugin. It statically recognizes route registrations against net/http's ServeMux:

mux.HandleFunc("GET /users/{id}", GetUser)
mux.Handle("POST /users", http.HandlerFunc(CreateUser))
http.HandleFunc("/health", HealthCheck)

Patterns follow Go 1.22's enhanced ServeMux syntax ("METHOD /path"). Per net/http's own ServeMux docs, "a pattern with no method matches every method" — so a registration like http.HandleFunc("/health", HealthCheck) expands into one Route per HTTP method gota's model supports (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE), all bound to the same handler, rather than being narrowed to GET. Path parameters use the same "{name}" syntax as OpenAPI path templates, so no translation is needed between the two.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct{}

func New

func New() *Plugin

func (*Plugin) Extract

func (p *Plugin) Extract(pkg *packages.Package) ([]router.Route, error)

func (*Plugin) Name

func (p *Plugin) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL