platform/experiment/container/example2/bin/example.dart

30 lines
812 B
Dart
Raw Normal View History

2023-01-25 02:23:40 +00:00
import 'package:angel3_container/angel3_container.dart';
import 'package:angel3_container_generator/angel3_container_generator.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'example.reflectable.dart';
@Expose('/controller')
class MyController extends Controller {
@Expose('/')
a() => "Hello, world!";
}
void main() async {
2023-01-28 02:26:27 +00:00
initializeReflectable();
2023-01-25 02:23:40 +00:00
var reflector = const GeneratedReflector();
Container container = Container(reflector);
container.registerSingleton<MyController>(MyController());
var app = Angel(reflector: reflector);
var http = AngelHttp(app);
2023-01-28 02:26:27 +00:00
//await app.mountController<MyController>();
2023-01-25 02:23:40 +00:00
2023-01-28 02:26:27 +00:00
var server = await http.startServer('localhost', 3000);
2023-01-25 02:23:40 +00:00
print("Angel server listening at ${http.uri}");
}