app.html
The html
method in the RoutesDefinitionApi
class is designed to define a route that handles and displays an HTML page. This method is used to create routes that return HTML content in response to client requests.
Method Signature
html(pattern: string, handler: CustomRouteHandlerFn): GetRouteRef
Parameters
-
pattern:
string
- Description: A string indicating the route path.
This path defines the URL at which this route will be accessible. - Example:
/about
,/contact
- Description: A string indicating the route path.
-
handler:
CustomRouteHandlerFn
- Description: A function that handles the route.
This function takes the context and request, and then returns an HTML response.
- Description: A function that handles the route.
Return Value
GetRouteRef
: An object representing a reference to the created route. It can be used for further manipulation of the route if necessary.
Properties of GetRouteRef
-
pattern:
string
The route pattern. -
handlerFn:
RouteRefHandlerFn
The handler function for the route. -
needParams:
boolean | null
An optional flag indicating whether parameters are required. -
routerUrlPath:
string | null
An optional URL path for the route. -
accountUrl:
AccountUrlFn
A function that returns the account URL.