openGates method
Future<void>
openGates(
{ - int port = 3000,
- bool enableLogs = true,
})
Implementation
Future<void> openGates({
int port = 3000,
bool enableLogs = true,
}) async {
// TODO :: Set the `enableLogs` to true by default in debug only
if (enableLogs) {
final tempGuards = [..._globalGuards];
_globalGuards.clear();
_globalGuards.addAll([LogsGuard(), ...tempGuards]);
}
await _server?.close(force: true);
/// open the server
_server = await HttpServer.bind(InternetAddress.loopbackIPv4, port);
/// print the server url
print('Listening on http://localhost:$port');
/// add listener to incoming requests stream
_server!.listen(_mainPipe);
}