Skip to content

Function: validateRouteFormat()

API / @xmachines/play-router / validateRouteFormat

function validateRouteFormat(routePath, stateId): void;

Defined in: validate-routes.ts:27

Checks the format of a route path

The function requires a string that is not empty. It accepts an absolute path (“/foo”) and also a relative path (“foo” or “child/nested”). A relative route receives the path prefix of its parent state during the construction of the tree.

Parameters

ParameterTypeDescription
routePathstringThe route path to check: absolute or relative
stateIdstringThe identifier of the state, for the error message

Returns

void

Throws

When the route path is empty