Script
You may also run Conduit applications with a standalone script, instead of conduit serve. In fact, conduit serve creates a temporary Dart script to run the application. If you created your application with conduit create, a standalone already exists in your project named bin/main.dart.
A sample script looks like this:
1
import 'dart:async';
2
import 'dart:io';
3
4
import 'package:conduit/conduit.dart';
5
import 'package:my_application/my_application.dart';
6
7
Future main() async {
8
var app = new Application<MyApplicationChannel>()
9
..options.port = 8888
10
..options.configurationFilePath = "config.yaml";
11
12
await app.start(numberOfInstances: 3);
13
}
Copied!
This script can be used in place of conduit serve, but you must configure all ApplicationOptions in this script and not through the CLI.
Last modified 6mo ago
Copy link