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

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

View file

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

View file

@ -12,19 +12,19 @@ class MyController extends Controller {
} }
void main() async { void main() async {
initializeReflectable();
var reflector = const GeneratedReflector(); var reflector = const GeneratedReflector();
Container container = Container(reflector); Container container = Container(reflector);
container.registerSingleton<MyController>(MyController()); container.registerSingleton<MyController>(MyController());
initializeReflectable();
var app = Angel(reflector: reflector); var app = Angel(reflector: reflector);
var http = AngelHttp(app); 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}"); print("Angel server listening at ${http.uri}");
} }

View file

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