openGates method

Future<void> openGates({
  1. int port = 3000,
  2. String? ip,
  3. bool enableLogs = true,
})

Implementation

Future<void> openGates({
  int port = 3000,
  String? ip,
  bool enableLogs = true,
}) async {
  _bootstrap();
  // await PalaceDB.init();
  ip ??= InternetAddress.anyIPv4.address;
  if (enableLogs) {
    final tempGuards = [..._globalGuards];
    _globalGuards.clear();
    _globalGuards.addAll([
      // LogsGuard(),
      ...tempGuards,
    ]);
  }
  await _server?.close(force: true);

  /// open the server
  _server = await HttpServer.bind(ip, port);

  /// print the server url
  print('Listening on http://localhost:$port');

  /// add listener to incoming requests stream
  _server!.listen(_mainPipe);
}