Open wamynobe opened 10 months ago
Hi @wamynobe 👋 ! I'm curious to know if you have a proposal on how this should be done 👀, for example, do you have an API in mind?
Hi @alestiago . I have some ideals.
void main() async {
entrypoint.bootstrap(
() async {
final address = InternetAddress.tryParse('{{{host}}}') ?? InternetAddress.anyIPv6;
final port = int.tryParse(Platform.environment['PORT'] ?? '{{{port}}}') ?? {{{port}}};{{#invokeCustomInit}}
await entrypoint.init(address, port);{{/invokeCustomInit}}
hotReload(() => createServer(address, port));
}
);
}
Can we add a bootstrap function in custom main file? This may help in some cases like using third-party SDK in order to log errors on my server. Then we can go like
void bootstrap(void Function() callback) async{
runZonedGuarded(
() => callback.call(),
(error, stack) {
// I want to log the error here
log('Error: $error');
},
);
}
Or if you want to use SentrySDK for dart you can go like
void bootstrap(void Function() callback) async{
await Sentry.init(
(options) {
options.dsn = 'https://example@sentry.io/example';
},
appRunner: callback,
);
}
That's all! I'm new here so please forgive me if I've said anything wrong ^_^.
I am trying to figure out how to use Mason and how to customize these bricks. I want to check my ideal but I have not found a way to custom dart_frog_dev_server yet.
I checked dart_frog_dev_server brick but I have no ideal how to modify this file because of the line "// GENERATED CODE - DO NOT MODIFY BY HAND". I'm confused!
@wamynobe thank you for taking an initiative here 💙 .
There is a CONTRIBUTING guide for updating Dart Frog CLI. There is no CONTRIBUTING guide for the bricks. I think we should have one. I may be able to provide one, however, you might have to bear with me, since I have other tasks with greater priority.
In terms of moving forward and adding global exception catching, it needs to be discussed with the team and evaluated. In the meantime, if you would like to work on a proof of concept, please do!
@alestiago Thank you for the instructions. I can now edit the server.dart file and it works as I expected. Thanks for pointing out the contribute section in the cli. I honestly overlooked it when trying to modify bricks and bundles. Regarding this issue, after discussing with the team, if there is anything I can help with, please ask!
Description
Clearly describe what you are looking to add. The more context the better.
Requirements
Additional Context
Add any other context or screenshots about the feature request go here.