MCPcopy
hub / github.com/gofiber/fiber / parseRoute

Function parseRoute

path.go:265–276  ·  view source on GitHub ↗

parseRoute analyzes the route and divides it into segments for constant areas and parameters, this information is needed later when assigning the requests to the declared routes

(pattern string, regexHandler any, customConstraints ...CustomConstraint)

Source from the content-addressed store, hash-verified

263// parseRoute analyzes the route and divides it into segments for constant areas and parameters,
264// this information is needed later when assigning the requests to the declared routes
265func parseRoute(pattern string, regexHandler any, customConstraints ...CustomConstraint) routeParser {
266 parser := routeParser{}
267 parser.parseRoute(pattern, regexHandler, customConstraints...)
268
269 // Check if the route has too many parameters
270 if len(parser.params) > maxParams {
271 panic(fmt.Sprintf("Route '%s' has %d parameters, which exceeds the maximum of %d",
272 pattern, len(parser.params), maxParams))
273 }
274
275 return parser
276}
277
278// addParameterMetaInfo add important meta information to the parameter segments
279// to simplify the search for the end of the parameter

Calls 1

parseRouteMethod · 0.95