merge from master
This commit is contained in:
commit
772f74a908
8 changed files with 51 additions and 79 deletions
5
.vscode/launch.json
vendored
5
.vscode/launch.json
vendored
|
@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
27
.vscode/tasks.json
vendored
27
.vscode/tasks.json
vendored
|
@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
55
README.md
55
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_common/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
|
||||
|
|
16
bin/dev.dart
16
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}');
|
||||
}
|
||||
|
|
|
@ -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<String> args) => Runner('{{angel}}', configureServer).run(args);
|
||||
main(List<String> args) =>
|
||||
Runner('{{angel}}', configureServer, reflector: MirrorsReflector())
|
||||
.run(args);
|
||||
|
|
|
@ -10,7 +10,7 @@ Future<void> configureServer(Angel app) async {
|
|||
await connection.open();
|
||||
|
||||
app
|
||||
..container.registerSingleton<QueryExecutor>(PostgreSQLExecutor(connection))
|
||||
..container.registerSingleton<QueryExecutor>(PostgreSqlExecutor(connection))
|
||||
..shutdownHooks.add((_) => connection.close());
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,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,
|
||||
|
@ -75,15 +75,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);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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_migration: ^2.0.0-alpha # Migration runtime support
|
||||
angel_orm: ^2.0.0-dev # Migration runtime support
|
||||
|
|
Loading…
Reference in a new issue