Router.new
External Documentation
Router(
Creates a new Express router.
Implementation
factory Router() {
final express = switch (requireModule('express')) {
final JSObject o => o,
_ => throw StateError('Express module not found'),
};
final routerFn = switch (express['Router']) {
final JSFunction f => f,
_ => throw StateError('Express Router not found'),
};
final result = switch (routerFn.callAsFunction(null)) {
final JSObject o => o,
_ => throw StateError('Router creation failed'),
};
return Router._(result);
}