Updated README

This commit is contained in:
thomashii 2021-08-20 13:46:02 +08:00
parent 68e410b94b
commit a22e0fd752
3 changed files with 66 additions and 53 deletions

View file

@ -1,5 +1,10 @@
# Change Log # Change Log
## 4.1.2
* Updated README
* Fixed NNBD issues
## 4.1.1 ## 4.1.1
* Updated link to `Angel3` home page * Updated link to `Angel3` home page

View file

@ -1,63 +1,71 @@
# Angel3 Framework # Angel3 Framework
[![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dev/packages/angel3_framework) [![version](https://img.shields.io/badge/pub-v4.1.2-brightgreen)](https://pub.dev/packages/angel3_framework)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/framework/LICENSE) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/framework/LICENSE)
A high-powered HTTP server with support for dependency injection, sophisticated routing and more. Angel3 is designed to keep the core minimal but extensible. Angel3 won't dictate which database or web templating engine to use. Everything is customizable, so that Angel3 can grow to support your application as your use cases increases in complexity. **Replacement of Angel Framework with major change to support NNBD**
Angel3 framework is a high-powered HTTP server with support for dependency injection, sophisticated routing, authentication, ORM, graphql etc. It is designed to keep the core minimal but extensible through a series of plugin packages. It won't dictate which features, databases or web templating engine to use. This flexibility enable Angel3 framework to grow with your application as new features can be added to handle the new use cases.
This is the core of the [Angel3](https://github.com/dukefirehawk/angel/tree/angel3) framework. To build real-world applications, please see the [User Guide](https://angel3-docs.dukefirehawk.com). This package is the core of the [Angel3](https://github.com/dukefirehawk/angel/tree/angel3) framework. To see more details, please refer to the [Developer Guide](https://angel3-docs.dukefirehawk.com).
```dart ## Usage
import 'package:angel3_container/mirrors.dart';
import 'package:angel3_framework/angel3_framework.dart';
void main() async { ### Create a new project by cloning from boilerplate templates
var app = Angel(reflector: MirrorsReflector());
// Index route. Returns JSON. 1. Download and install [Dart](https://dart.dev/get-dart)
app.get('/', (req, res) => res.write('Welcome to Angel3!'));
// Accepts a URL like /greet/foo or /greet/bob. 2. Clone one of the following starter projects:
app.get( * [Angel3 Basic Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-basic)
'/greet/:name', * [Angel3 ORM Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-orm)
(req, res) { * [Angel3 Graphql Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-graphql)
var name = req.params['name'];
res
..write('Hello, $name!')
..close();
},
);
// Pattern matching - only call this handler if the query value of `name` equals 'emoji'. 3. Run the project in development mode (*hot-reloaded* is enabled on file changes).
app.get(
'/greet',
ioc((@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥'),
);
// Handle any other query value of `name`. ```bash
app.get( dart --observe bin/dev.dart
'/greet', ```
ioc((@Query('name') String name) => 'Hello, $name!'),
);
// Simple fallback to throw a 404 on unknown paths. 4. Run the project in production mode (*hot-reloaded* is disabled).
app.fallback((req, res) {
throw AngelHttpException.notFound(
message: 'Unknown path: "${req.uri.path}"',
);
});
var http = AngelHttp(app); ```bash
var server = await http.startServer('127.0.0.1', 3000); dart bin/prod.dart
var url = 'http://${server.address.address}:${server.port}'; ```
print('Listening at $url');
print('Visit these pages to see Angel in action:'); 5. Run as docker. Edit and build the image with the provided `Dockerfile` file.
print('* $url/greet/bob');
print('* $url/greet/?name=emoji'); ### Create a new project with Angel3 CLI
print('* $url/greet/?name=jack');
print('* $url/nonexistent_page'); 1. Download and install [Dart](https://dart.dev/get-dart)
}
``` 2. Install the [Angel3 CLI](https://pub.dev/packages/angel3_cli):
```bash
dart pub global activate angel3_cli
```
3. On terminal, create a new project:
```bash
angel3 init hello
```
4. Run the project in development mode (*hot-reloaded* is enabled on file changes).
```bash
dart --observe bin/dev.dart
```
5. Run the project in production mode (*hot-reloaded* is disabled).
```bash
dart bin/prod.dart
```
6. Run as docker. Edit and build the image with the provided `Dockerfile` file.
### Migrating from Angel to Angel3
Check out [Migrating to Angel3](https://angel3-docs.dukefirehawk.com/migration/angel-2.x.x-to-angel3/migration-guide-3)

View file

@ -1,8 +1,8 @@
name: angel3_framework name: angel3_framework
version: 4.1.1 version: 4.1.2
description: A high-powered HTTP server extensible framework with dependency injection, routing and much more. description: A high-powered HTTP server extensible framework with dependency injection, routing and much more.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/framework repository: https://github.com/dukefirehawk/angel
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies: