registerHandler method
dynamic
registerHandler({})
Implementation
registerHandler( {String path = "*",Function? requestHandler,ResponseProcessor? responseProcessor,Function? errorFunction}) async {
jaguarMux.Route route = jaguarMux.Route.get(path, (context) async {
try {
if (requestHandler != null) {
SimpleWebRR webRR = await _getSimpleWebRR(context);
webRR = await requestHandler(webRR);
context.response = await _getResponseFromSimpleWebRR(webRR);
} else {
context.response = Response(statusCode: 400);
}
} catch (ex,stack) {
context.response = Response.html(Simplify.getExceptionMessage(ex,stack: stack));
if (errorFunction != null) {
dynamic errorResponse =
errorFunction(Simplify.getExceptionMessage(ex,stack: stack));
if (errorResponse != null) {
context.response = Response.html(errorResponse);
}
}
}
}, responseProcessor: responseProcessor);
routes.add(route);
}