dashpub 0.0.2 copy "dashpub: ^0.0.2" to clipboard
dashpub: ^0.0.2 copied to clipboard

The core server implementation for the Dashpub private registry.

example/example.dart

import 'dart:io';

Future<void> main() async {
  // This example demonstrates how to initialize and start the Dashpub server.
  // Note: This requires a running MongoDB instance and a directory for package storage.

  // final mongoUrl = Platform.environment['DASHPUB_MONGO_URL'] ??
  //     'mongodb://localhost:27017/dashpub';
  // final storageDir =
  //     Platform.environment['DASHPUB_STORAGE_DIR'] ?? './dashpub_storage';

  // 1. Initialize the Metadata Store (MongoDB)
  // final metaStore = MongoStore(mongoUrl);
  // await metaStore.db.open();

  // 2. Initialize the Package Store (File System)
  // final packageStore = FileStore(storageDir);

  // 3. Configure the Dashpub Application
  // final app = DashpubApp(
  //   metaStore: metaStore,
  //   packageStore: packageStore,
  //   upstream: 'https://pub.dev', // Proxy to pub.dev for missing packages
  // );

  // 4. Start the Server
  // final server = await app.serve('0.0.0.0', 4000);
  // print('Dashpub server listening on http://${server.address.host}:${server.port}');

  print(
    'This is a structural example. See bin/dashpub_server.dart for the full implementation.',
  );
}