From 62670f07717fc6348160cfebb0ca1ca8c6fcc6d4 Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Wed, 23 Jan 2019 14:44:10 -0500 Subject: [PATCH 01/14] Update pubspec.yaml --- pubspec.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index ab6215d..9967416 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,16 +5,16 @@ environment: sdk: '>=2.0.0-dev <3.0.0' homepage: https://github.com/angel-dart/angel dependencies: - angel_auth: ^2.0.0-alpha # Supports stateless authentication via JWT + angel_auth: ^2.0.0 # Supports stateless authentication via JWT angel_configuration: ^2.0.0 # Loads application configuration, along with support for .env files. angel_framework: ^2.0.0-alpha # The core server library. angel_jael: ^2.0.0 # Server-side templating engine angel_production: ^1.0.0-alpha - angel_static: ^2.0.0-alpha # Static file server - angel_validate: ^2.0.0-alpha # Allows for validation of input data + angel_static: ^2.0.0 # Static file server + angel_validate: ^2.0.0 # Allows for validation of input data dev_dependencies: angel_hot: ^2.0.0 # Hot-reloading support. :) - angel_test: ^2.0.0-alpha # Utilities for testing Angel servers. + angel_test: ^2.0.0a # Utilities for testing Angel servers. io: ^0.3.2 pedantic: ^1.0.0 test: ^1.0.0 From 06af5078e09b0010f9f01cdc7e0d21552a9b1ef6 Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Wed, 23 Jan 2019 14:45:20 -0500 Subject: [PATCH 02/14] Update routes.dart --- lib/src/routes/routes.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index a75a12d..ad91ef9 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -47,7 +47,7 @@ AngelConfigurer configureServer(FileSystem fileSystem) { var oldErrorHandler = app.errorHandler; app.errorHandler = (e, req, res) async { - if (!req.accepts('text/html')) + if (!req.accepts('text/html', strict: true)) return await oldErrorHandler(e, req, res); else { if (e.statusCode == 404) { From 5f89710996b464199292dd62641243eeb3ca169a Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Sun, 27 Jan 2019 19:48:33 -0500 Subject: [PATCH 03/14] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9967416..765a66a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: angel_validate: ^2.0.0 # Allows for validation of input data dev_dependencies: angel_hot: ^2.0.0 # Hot-reloading support. :) - angel_test: ^2.0.0a # Utilities for testing Angel servers. + angel_test: ^2.0.0 # Utilities for testing Angel servers. io: ^0.3.2 pedantic: ^1.0.0 test: ^1.0.0 From ec53896d86ba07cc67075ac92fc880910ef6033d Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Sun, 3 Feb 2019 01:04:35 -0500 Subject: [PATCH 04/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aff56f6..b9f1cd7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [Wiki (in-depth documentation)](https://github.com/angel-dart/angel/wiki) -[API Documentation](http://www.dartdocs.org/documentation/angel_common/latest) +[API Documentation](http://www.dartdocs.org/documentation/angel_framework/latest) [Roadmap](https://github.com/angel-dart/roadmap/blob/master/ROADMAP.md) From 014c07a89fdd287c20aeb7a34e442a505b960ab2 Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Wed, 6 Feb 2019 16:57:53 -0500 Subject: [PATCH 05/14] Update dev.dart --- bin/dev.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/dev.dart b/bin/dev.dart index 9ea61b0..a6339bf 100644 --- a/bin/dev.dart +++ b/bin/dev.dart @@ -12,9 +12,8 @@ main() async { var app = new Angel(reflector: MirrorsReflector()); await app.configure(configureServer); hierarchicalLoggingEnabled = true; - app.logger = new Logger('angel'); - var sub = app.logger.onRecord.listen(prettyLog); - app.shutdownHooks.add((_) => sub.cancel()); + app.logger = new Logger.detached('{{angel}}')..onRecord.listen(prettyLog); + app.shutdownHooks.add((_) => app.logger.clearListeners()); return app; }, [ new Directory('config'), From 2c787f75719a4245eb2e4295d412d3a0f8898c22 Mon Sep 17 00:00:00 2001 From: Tobe Osakwe Date: Wed, 6 Feb 2019 23:00:28 -0500 Subject: [PATCH 06/14] Update dev.dart --- bin/dev.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/dev.dart b/bin/dev.dart index a6339bf..802864a 100644 --- a/bin/dev.dart +++ b/bin/dev.dart @@ -13,7 +13,6 @@ main() async { await app.configure(configureServer); hierarchicalLoggingEnabled = true; app.logger = new Logger.detached('{{angel}}')..onRecord.listen(prettyLog); - app.shutdownHooks.add((_) => app.logger.clearListeners()); return app; }, [ new Directory('config'), From 30c2add0f34463698ac3d9f30259cd46f9c27f23 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:04:33 -0400 Subject: [PATCH 07/14] Delete tasks.json --- .vscode/tasks.json | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 0479cc0..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "0.1.0", - "command": "pub", - "isShellCommand": true, - "echoCommand": true, - "showOutput": "always", - "tasks": [ - { - "taskName": "pub:build", - "suppressTaskName": true, - "args": [ - "build" - ] - }, - { - "taskName": "pub:serve", - "showOutput": "silent", - "suppressTaskName": true, - "isBackground": true, - "args": [ - "serve" - ] - } - ] -} \ No newline at end of file From 14da50550e84ab25403f8c60026c033fb72d8930 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:04:54 -0400 Subject: [PATCH 08/14] ANGEL_ENV -> production in launch.json --- .vscode/launch.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 2c69cf0..a172648 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,10 @@ "name": "Production Server", "type": "dart", "request": "launch", - "program": "${workspaceRoot}/bin/prod.dart" + "program": "${workspaceRoot}/bin/prod.dart", + "env": { + "ANGEL_ENV": "production" + } } ] } From 7773303a07f4506eee77be511fbd0947da3c0eef Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:05:40 -0400 Subject: [PATCH 09/14] Edit bin/dev.dart for logging logic --- bin/dev.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/dev.dart b/bin/dev.dart index 802864a..a2c4df3 100644 --- a/bin/dev.dart +++ b/bin/dev.dart @@ -8,17 +8,19 @@ import 'package:logging/logging.dart'; main() async { // Watch the config/ and web/ directories for changes, and hot-reload the server. - var hot = new HotReloader(() async { - var app = new Angel(reflector: MirrorsReflector()); + hierarchicalLoggingEnabled = true; + + var hot = HotReloader(() async { + var logger = Logger.detached('{{angel}}')..onRecord.listen(prettyLog); + var app = Angel(logger: logger, reflector: MirrorsReflector()); await app.configure(configureServer); - hierarchicalLoggingEnabled = true; - app.logger = new Logger.detached('{{angel}}')..onRecord.listen(prettyLog); return app; }, [ - new Directory('config'), - new Directory('lib'), + Directory('config'), + Directory('lib'), ]); var server = await hot.startServer('127.0.0.1', 3000); - print('{{angel}} server listening at http://${server.address.address}:${server.port}'); + print( + '{{angel}} server listening at http://${server.address.address}:${server.port}'); } From a7d6a8cf76e4df7729272ce908da9bd4d0378ed7 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:06:43 -0400 Subject: [PATCH 10/14] Use mirrors reflector in prod by default --- bin/prod.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/prod.dart b/bin/prod.dart index b7f1728..db0ec67 100644 --- a/bin/prod.dart +++ b/bin/prod.dart @@ -1,4 +1,5 @@ import 'package:angel/angel.dart'; +import 'package:angel_container/mirrors.dart'; import 'package:angel_production/angel_production.dart'; // NOTE: By default, the Runner class does not use the `MirrorsReflector`, or any @@ -11,7 +12,7 @@ import 'package:angel_production/angel_production.dart'; // * Use of Controllers, via @Expose() or @ExposeWS() // * Use of dependency injection into constructors, whether in controllers or plain `container.make` calls // * Use of the `ioc` function in any route -// +// // The `MirrorsReflector` from `package:angel_container/mirrors.dart` is by far the most convenient pattern, // so use it if possible. // @@ -24,4 +25,6 @@ import 'package:angel_production/angel_production.dart'; // so in the meantime, visit the Angel chat for further questions: // // https://gitter.im/angel_dart/discussion -main(List args) => Runner('{{angel}}', configureServer).run(args); +main(List args) => + Runner('{{angel}}', configureServer, reflector: MirrorsReflector()) + .run(args); From 9d8cd1b6f31646acf37b769cd67ba6f151b08197 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:07:07 -0400 Subject: [PATCH 11/14] Bump angel_framework dep --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 765a66a..e124b4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ homepage: https://github.com/angel-dart/angel dependencies: angel_auth: ^2.0.0 # Supports stateless authentication via JWT angel_configuration: ^2.0.0 # Loads application configuration, along with support for .env files. - angel_framework: ^2.0.0-alpha # The core server library. + angel_framework: ^2.0.0-rc.0 # The core server library. angel_jael: ^2.0.0 # Server-side templating engine angel_production: ^1.0.0-alpha angel_static: ^2.0.0 # Static file server From de883218653151f432a86eb04c82c98123a67065 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:07:17 -0400 Subject: [PATCH 12/14] Use app.environment --- lib/src/routes/routes.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index ad91ef9..dfcc7a2 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -28,7 +28,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 - if (!app.isProduction) { + if (!app.environment.isProduction) { var vDir = VirtualDirectory( app, fileSystem, From f90bcfe27b1385d433a39fdffa0508674e2285b7 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:09:37 -0400 Subject: [PATCH 13/14] Fix error handling --- lib/src/routes/routes.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index dfcc7a2..9396211 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -47,15 +47,15 @@ AngelConfigurer configureServer(FileSystem fileSystem) { var oldErrorHandler = app.errorHandler; app.errorHandler = (e, req, res) async { - if (!req.accepts('text/html', strict: true)) - return await oldErrorHandler(e, req, res); - else { - if (e.statusCode == 404) { - return await res + if (req.accepts('text/html', strict: true)) { + if (e.statusCode == 404 && req.accepts('text/html', strict: true)) { + await res .render('error', {'message': 'No file exists at ${req.uri}.'}); + } else { + await res.render('error', {'message': e.message}); } - - return await res.render('error', {'message': e.message}); + } else { + return await oldErrorHandler(e, req, res); } }; }; From 96b27a402b5fc715f43f356598de72aaeb6081ae Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 12:18:39 -0400 Subject: [PATCH 14/14] Clean up README --- README.md | 55 +++++++++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index b9f1cd7..82ae3b4 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,25 @@ -[![The Angel Framework](https://angel-dart.github.io/assets/images/logo.png)](https://angel-dart.github.io) +[![The Angel Framework](https://angel-dart.github.io/assets/images/logo.png)](https://angel-dart.dev) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/angel_dart/discussion) [![Pub](https://img.shields.io/pub/v/angel_framework.svg)](https://pub.dartlang.org/packages/angel_framework) [![Build status](https://travis-ci.org/angel-dart/framework.svg?branch=master)](https://travis-ci.org/angel-dart/framework) ![License](https://img.shields.io/github/license/angel-dart/framework.svg) -**A batteries-included, full-stack Web server framework for Dart.** +**A polished, production-ready backend framework in Dart.** ----- +## About +Angel is a full-stack Web framework in Dart. It aims to +streamline development by providing many common features +out-of-the-box in a consistent manner. -[Wiki (in-depth documentation)](https://github.com/angel-dart/angel/wiki) - -[API Documentation](http://www.dartdocs.org/documentation/angel_framework/latest) - -[Roadmap](https://github.com/angel-dart/roadmap/blob/master/ROADMAP.md) - -[File an Issue](https://github.com/angel-dart/roadmap/issues) - -[Awesome Angel :fire:](https://github.com/angel-dart/awesome-angel) - - - -Like what you see? Please lend us a star! :star: - -## Newest Tutorials -* [Dependency Injection Patterns with Angel 2](https://thosakwe.com/dependency-injection-patterns-in-angel-2/) -* [Angel 2.0.0 is Almost Here - What it Means for You](https://thosakwe.com/new-features-coming-to-angel-in-version-2-0-0/) -* [GraphQL is coming to Angel (and Dart)](https://thosakwe.com/graphql-is-coming-to-angel-and-dart/) +With features like the following, Angel is the all-in-one framework you should choose to build your next project: +* [GraphQL Support](https://github.com/angel-dart/graphql) +* [PostgreSQL ORM](https://github.com/angel-dart/orm) +* [Dependency Injection](https://docs.angel-dart.dev/guides/dependency-injection) +* And [much more](https://github.com/angel-dart)... ## Installation & Setup -*Having errors with a fresh Angel installation? See [here](https://angel-dart.gitbook.io/angel/the-basics/installation) for help.* Once you have [Dart](https://www.dartlang.org/) installed, bootstrapping a project is as simple as running a few shell commands: @@ -51,17 +41,18 @@ You can even have your server run and be *hot-reloaded* on file changes: dart --observe bin/dev.dart ``` -Next, check out the [detailed documentation](https://angel-dart.gitbook.io/angel) to learn to flesh out your project. +Next, check out the [detailed documentation](https://docs.angel-dart.dev/v/2.x) to learn to flesh out your project. -## Features -With features like the following, Angel is the all-in-one framework you should choose to build your next project: -* [Advanced, Modular Routing](https://github.com/angel-dart/route) -* [Middleware](https://angel-dart.gitbook.io/angel/the-basics/middleware) -* [Dependency Injection](https://angel-dart.gitbook.io/angel/the-basics/dependency-injection) -* [Strongly-typed ORM](https://github.com/angel-dart/orm) -* And [much more](https://github.com/angel-dart)... +## Examples and Documentation +Visit the [documentation](https://docs.angel-dart.dev/v/2.x) +for dozens of guides and resources, including video tutorials, +to get up and running as quickly as possible with Angel. -## Basic Example -Examples and complete projects can be found here: +Examples and complete projects can be found +[here](https://github.com/angel-dart/examples-v2). + + +You can also view the [API Documentation](http://www.dartdocs.org/documentation/angel_framework/latest). + +There is also an [Awesome Angel :fire:](https://github.com/angel-dart/awesome-angel) list. -https://github.com/angel-dart/examples-v2