Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom server properties (Dart API)? #3

Open
GustavoFigueira opened this issue Oct 28, 2024 · 0 comments
Open

Custom server properties (Dart API)? #3

GustavoFigueira opened this issue Oct 28, 2024 · 0 comments

Comments

@GustavoFigueira
Copy link

Hello, thank you for this repository!

I would like to know how to execute custom code with a main.dart file containing properties like the example below (from the Unpub documentation):

import 'package:mongo_dart/mongo_dart.dart';
import 'package:unpub/unpub.dart' as unpub;

main(List<String> args) async {
  final db = Db('mongodb://localhost:27017/dart_pub');
  await db.open(); // ensure the MongoDB connection is open

  final app = unpub.App(
    metaStore: unpub.MongoStore(db),
    overrideUploaderEmail: '[email protected]',
    packageStore: unpub.FileStore('./unpub-packages'),
  );

  final server = await app.serve('0.0.0.0', 4000);
  print('Serving at http://${server.address.host}:${server.port}');
}

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant