Skip to content

Request Flow

Plumego keeps the HTTP path visible from route registration to response write. The important test is simple: a maintainer should be able to point at the file that owns each step.

1

Register the route

one method, one path, one handler

2

Attach to the app

route table plus middleware chain

3

Match the request

method, path, params, groups

4

Run transport wrappers

request IDs, tracing, logging, rate limits

5

Handle and write

WriteResponse or WriteError

reference/standard-service/internal/app/routes.go
-> core route registration
-> router method/path match
-> transport-only middleware chain
-> net/http handler
-> contract.WriteResponse or contract.WriteError
StepSurfaceOwnsShould not own
Route registrationinternal/app/routes.goOne method, one path, one handlerHidden handler discovery
MatchrouterMethod/path matching, params, groups, reverse routesBusiness DTO assembly
WrapmiddlewareTransport-only behavior such as request IDs, tracing, logging, rate limitingService lookup or feature wiring
Handlefunc(http.ResponseWriter, *http.Request)Decode input, call explicit app code, choose success or errorFramework-specific handler contracts
WritecontractCanonical success and error response shapeFeature-specific helper families
func (h APIHandler) Greet(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
if name == "" {
_ = contract.WriteError(w, r, contract.NewErrorBuilder().
Type(contract.TypeRequired).
Detail("field", "name").
Message("name is required").
Build())
return
}
_ = contract.WriteResponse(w, r, http.StatusOK, greetResponse{Message: "hello, " + name}, nil)
}
QuestionWhere to check
Where did this endpoint get registered?reference/standard-service/internal/app/routes.go or the application route file
Which middleware layers run before it?The app/core wiring around the handler
Where are dependencies created?Application constructors, not request context service lookup
Which response shape is used?contract.WriteResponse for success; contract.WriteError for errors
Is this still standard-library compatible?Handler parameters remain http.ResponseWriter and *http.Request
Avoided patternReason
init() handler registrationMakes endpoint ownership hard to review
Context service locatorsHides dependency wiring in request state
Feature-specific response helper familiesSplits the canonical transport contract
Middleware that assembles business DTOsBlurs transport and application ownership