From f18929fd2276ab426964f43ecdcfeab391815547 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 9 Jul 2018 13:43:11 -0400 Subject: [PATCH 01/12] Update pubspec.yaml --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0847bf0b..22c77567 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,5 +16,5 @@ dependencies: dev_dependencies: angel_hot: ^1.1.0 # Hot-reloading support. :) angel_test: ^1.1.0 # Utilities for testing Angel servers. - console: ^2.2.4 - test: ^0.12.13 \ No newline at end of file + console: ^3.0.0 + test: ^0.12.13 From 0389803641d2b296fe04076251d0a16cfa3a2e68 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:42:43 -0400 Subject: [PATCH 02/12] Update prod.dart --- bin/prod.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/prod.dart b/bin/prod.dart index 0059c394..74991c50 100644 --- a/bin/prod.dart +++ b/bin/prod.dart @@ -23,6 +23,7 @@ void isolateMain(int id) { app.configure(configureServer).then((_) async { // In production, we'll want to log errors to a file. // Alternatives include sending logs to a service like Sentry. + hierarchicalLoggingEnabled = true; app.logger = new Logger('angel') ..onRecord.listen((rec) { if (rec.error == null) { From 6497b16e079e2f993a7544cdeccdfb28ca1cd131 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:42:51 -0400 Subject: [PATCH 03/12] Update dev.dart --- bin/dev.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/dev.dart b/bin/dev.dart index 2db404ea..5514cc7b 100644 --- a/bin/dev.dart +++ b/bin/dev.dart @@ -10,6 +10,7 @@ main() async { var hot = new HotReloader(() async { var app = new Angel()..lazyParseBodies = true; await app.configure(configureServer); + hierarchicalLoggingEnabled = true; app.logger = new Logger('angel'); var sub = app.logger.onRecord.listen(prettyLog); app.shutdownHooks.add((_) => sub.cancel()); From 30f823be2a48d5b249376086305a466fc39d9056 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:43:50 -0400 Subject: [PATCH 04/12] Update angel.dart --- lib/angel.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/angel.dart b/lib/angel.dart index e7183f50..e4c6f762 100644 --- a/lib/angel.dart +++ b/lib/angel.dart @@ -2,7 +2,6 @@ library angel; import 'dart:async'; -import 'package:angel_cors/angel_cors.dart'; import 'package:angel_framework/angel_framework.dart'; import 'package:file/local.dart'; import 'src/config/config.dart' as configuration; @@ -11,11 +10,12 @@ import 'src/services/services.dart' as services; /// Configures the server instance. Future configureServer(Angel app) async { - // Enable CORS - app.use(cors()); + // Grab a handle to the file system, so that we can do things like + // serve static files. + var fs = const LocalFileSystem(); // Set up our application, using the plug-ins defined with this project. - await app.configure(configuration.configureServer(const LocalFileSystem())); + await app.configure(configuration.configureServer(fs)); await app.configure(services.configureServer); - await app.configure(routes.configureServer(const LocalFileSystem())); + await app.configure(routes.configureServer(fs)); } From 086edc4fe6cbd3ec9e4b78da0eaee4015c861997 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:44:21 -0400 Subject: [PATCH 05/12] Update routes.dart --- lib/src/routes/routes.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index c816f8a3..dba89656 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -1,6 +1,7 @@ /// This app's route configuration. library angel.src.routes; +import 'package:angel_cors/angel_cors.dart'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_static/angel_static.dart'; import 'package:file/file.dart'; @@ -13,6 +14,9 @@ import 'controllers/controllers.dart' as controllers; /// * https://github.com/angel-dart/angel/wiki/Requests-&-Responses AngelConfigurer configureServer(FileSystem fileSystem) { return (Angel app) async { + // Enable CORS + app.use(cors()); + // Typically, you want to mount controllers first, after any global middleware. await app.configure(controllers.configureServer); From 367ea1eb369252c3133c162ab3b615a61dcc192e Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:44:56 -0400 Subject: [PATCH 06/12] Update routes.dart --- lib/src/routes/routes.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index dba89656..3eb91328 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -25,7 +25,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) { '/', (RequestContext req, ResponseContext res) => res.render('hello')); // Mount static server at web in development. - // This variant of `VirtualDirectory` also sends `Cache-Control` headers. + // The `CachingVirtualDirectory` variant of `VirtualDirectory` also sends `Cache-Control` headers. // // In production, however, prefer serving static files through NGINX or a // similar reverse proxy. @@ -33,7 +33,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) { // Read the following two sources for documentation: // * https://medium.com/the-angel-framework/serving-static-files-with-the-angel-framework-2ddc7a2b84ae // * https://github.com/angel-dart/static - var vDir = new CachingVirtualDirectory( + var vDir = new VirtualDirectory( app, fileSystem, source: fileSystem.directory('web'), From bdfe20513669e0a1f5ac0a6007f17fdff1feeacb Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 09:45:47 -0400 Subject: [PATCH 07/12] Update routes.dart --- lib/src/routes/routes.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index 3eb91328..44855b2d 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -33,12 +33,14 @@ AngelConfigurer configureServer(FileSystem fileSystem) { // Read the following two sources for documentation: // * https://medium.com/the-angel-framework/serving-static-files-with-the-angel-framework-2ddc7a2b84ae // * https://github.com/angel-dart/static - var vDir = new VirtualDirectory( - app, - fileSystem, - source: fileSystem.directory('web'), - ); - app.use(vDir.handleRequest); + if (!app.isProduction) { + var vDir = new VirtualDirectory( + app, + fileSystem, + source: fileSystem.directory('web'), + ); + app.use(vDir.handleRequest); + } // Throw a 404 if no route matched the request. app.use(() => throw new AngelHttpException.notFound()); From 45bacfe6cae4437bc009021b604db32aa9fbc362 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 11:54:16 -0400 Subject: [PATCH 08/12] Update analysis_options.yaml --- analysis_options.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 917f437b..bfcdf167 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,5 @@ analyzer: - strong-mode: true + strong-mode: + implicit-casts: false exclude: - - .scripts-bin/**/*.dart + - .dart_tool From 00da4ff10403cbcd16fc6246c7ef667b84b34c89 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 11 Jul 2018 11:54:23 -0400 Subject: [PATCH 09/12] Update analysis_options.yaml --- analysis_options.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index bfcdf167..1a46de2e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,3 @@ analyzer: strong-mode: implicit-casts: false - exclude: - - .dart_tool From 0537cc5724f8d798b7cc76acd90f27e459ac5dba Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 12 Jul 2018 10:51:51 -0400 Subject: [PATCH 10/12] Update prod.dart --- bin/prod.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/prod.dart b/bin/prod.dart index 74991c50..584c5817 100644 --- a/bin/prod.dart +++ b/bin/prod.dart @@ -1,4 +1,4 @@ -import 'dart:io' hide FileMode; +import 'dart:io'; import 'dart:isolate'; import 'package:angel/angel.dart'; import 'package:angel_framework/angel_framework.dart'; From 91d76226f6083466ca211c4edf0f47829fddbec4 Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Sat, 14 Jul 2018 18:58:12 -0400 Subject: [PATCH 11/12] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 22c77567..746709d7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ environment: homepage: https://github.com/angel-dart/angel dependencies: angel_auth: ^1.1.0 # Supports stateless authentication via JWT - angel_configuration: ^1.1.0 # Loads application configuration, along with support for .env files. + angel_configuration: ^1.2.0 # Loads application configuration, along with support for .env files. angel_cors: ^1.0.0 # CORS support angel_framework: ^1.1.0 # The core server library. angel_jael: ^1.0.0 # Server-side templating engine From e0c58ad28bbad6917bbc7cc92f689c66398fbc4b Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Sun, 15 Jul 2018 00:22:34 -0400 Subject: [PATCH 12/12] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 746709d7..406f2a26 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,5 +16,5 @@ dependencies: dev_dependencies: angel_hot: ^1.1.0 # Hot-reloading support. :) angel_test: ^1.1.0 # Utilities for testing Angel servers. - console: ^3.0.0 + console: ">=2.0.0 <4.0.0" test: ^0.12.13