Will finish routing changes tmw, then resolve issues

This commit is contained in:
thosakwe 2016-11-21 23:58:53 -05:00
parent 551a7f086f
commit eb24b0c43e
3 changed files with 14 additions and 14 deletions

View file

@ -97,10 +97,9 @@ class Angel extends AngelBase {
/// ///
/// Returns false on failure; otherwise, returns the HttpServer. /// Returns false on failure; otherwise, returns the HttpServer.
Future<HttpServer> startServer([InternetAddress address, int port]) async { Future<HttpServer> startServer([InternetAddress address, int port]) async {
var server = await _serverGenerator( final host = address ?? InternetAddress.LOOPBACK_IP_V4;
address ?? InternetAddress.LOOPBACK_IP_V4, port ?? 0); final server = await _serverGenerator(host, port ?? 0);
this.httpServer = server; return this.httpServer = server..listen(handleRequest);
return server..listen(handleRequest);
} }
/// Loads some base dependencies into the service container. /// Loads some base dependencies into the service container.
@ -185,8 +184,7 @@ class Angel extends AngelBase {
if (requestedUrl.isEmpty) requestedUrl = '/'; if (requestedUrl.isEmpty) requestedUrl = '/';
final route = resolve(requestedUrl, final route = resolve(requestedUrl, method: request.method);
(route) => route.method == request.method || route.method == '*');
print('Resolve ${requestedUrl} -> $route'); print('Resolve ${requestedUrl} -> $route');
req.params.addAll(route?.parseParameters(requestedUrl) ?? {}); req.params.addAll(route?.parseParameters(requestedUrl) ?? {});

View file

@ -3,14 +3,16 @@ version: 1.0.0-dev.22
description: Core libraries for the Angel framework. description: Core libraries for the Angel framework.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_framework homepage: https://github.com/angel-dart/angel_framework
environment:
sdk: ">=1.18.0"
dependencies: dependencies:
angel_route: angel_route:
path: ../angel_route path: ../angel_route
body_parser: ">=1.0.0-dev <2.0.0" body_parser: ^1.0.0-dev
container: ">=0.1.2 <1.0.0" container: ^0.1.2
json_god: ">=2.0.0-beta <3.0.0" json_god: ^2.0.0-beta
merge_map: ">=1.0.0 <2.0.0" merge_map: ^1.0.0
mime: ">=0.9.3 <1.0.0" mime: ^0.9.3
dev_dependencies: dev_dependencies:
http: ">= 0.11.3 <0.12.0" http: ^0.11.3
test: ">= 0.12.13 <0.13.0" test: ^0.12.13

View file

@ -52,7 +52,7 @@ main() {
}); });
tearDown(() async { tearDown(() async {
await server.close(force: true); await (server ?? app.httpServer).close(force: true);
client.close(); client.close();
client = null; client = null;
}); });