Updated test cases

This commit is contained in:
thomashii@dukefirehawk.com 2023-01-28 10:26:27 +08:00
parent 55ecadce60
commit 87910959fa
4 changed files with 10 additions and 8 deletions

View file

@ -9,17 +9,19 @@ void main() async {
var app = Angel(logger: Logger('example'), reflector: MirrorsReflector());
var http = AngelHttp(app);
app.get("/", (req, res) => "Hello, world!");
// Simple fallback to throw a 404 on unknown paths.
/*
app.fallback((req, res) {
throw AngelHttpException.notFound(
message: 'Unknown path: "${req.uri?.path}"',
);
});
*/
var server = await http.startServer('localhost', 3000);
await http.startServer('localhost', 3000);
print("End");
}

View file

@ -2,7 +2,7 @@ name: example1
version: 0.0.1
description: Example 1.
environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'
dependencies:
angel3_container: ^7.0.0
angel3_http_exception: ^7.0.0

View file

@ -12,19 +12,19 @@ class MyController extends Controller {
}
void main() async {
initializeReflectable();
var reflector = const GeneratedReflector();
Container container = Container(reflector);
container.registerSingleton<MyController>(MyController());
initializeReflectable();
var app = Angel(reflector: reflector);
var http = AngelHttp(app);
await app.mountController<MyController>();
//await app.mountController<MyController>();
var server = await http.startServer();
var server = await http.startServer('localhost', 3000);
print("Angel server listening at ${http.uri}");
}

View file

@ -2,7 +2,7 @@ name: example2
version: 0.0.1
description: Example 2.
environment:
sdk: '>=2.17.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'
dependencies:
angel3_container: ^7.0.0
angel3_container_generator: ^7.0.0