Skip to content

resolveGoRoutes

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/libs/parser-core/src/techdocs/cross-file-routes.ts

Finish the Go facts that only exist across files: a route's prefix, and a handler's response body.

The Gin idiom registers a package's routes through a function: articles.Register( v1.Group("/articles")) in main.go, with router.GET("/feed", …) in articles/routers.go. The routes' own file knows only the suffix — /feed — so documenting it alone points a reader at a URL the service does not answer on.

Joins on the registrar function's name. A route whose registrar is never called keeps its suffix and stays flagged, rather than being published as if it were absolute.

The response half is the same shape of problem: routes.go registers h.SignUp, the handler is in user.go, and the struct it writes is declared in response.go. See resolveGoResponses.

Signature

ts
function resolveGoRoutes(entities: Entity[]): number

Parameters

NameType
entitiesEntity[]

Returns: number

Was this page helpful?

Download as PDF