Updated README
This commit is contained in:
parent
68e410b94b
commit
a22e0fd752
3 changed files with 66 additions and 53 deletions
|
@ -1,5 +1,10 @@
|
|||
# Change Log
|
||||
|
||||
## 4.1.2
|
||||
|
||||
* Updated README
|
||||
* Fixed NNBD issues
|
||||
|
||||
## 4.1.1
|
||||
|
||||
* Updated link to `Angel3` home page
|
||||
|
|
|
@ -1,63 +1,71 @@
|
|||
# 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)
|
||||
[![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)
|
||||
|
||||
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
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
## Usage
|
||||
|
||||
void main() async {
|
||||
var app = Angel(reflector: MirrorsReflector());
|
||||
### Create a new project by cloning from boilerplate templates
|
||||
|
||||
// Index route. Returns JSON.
|
||||
app.get('/', (req, res) => res.write('Welcome to Angel3!'));
|
||||
1. Download and install [Dart](https://dart.dev/get-dart)
|
||||
|
||||
// Accepts a URL like /greet/foo or /greet/bob.
|
||||
app.get(
|
||||
'/greet/:name',
|
||||
(req, res) {
|
||||
var name = req.params['name'];
|
||||
res
|
||||
..write('Hello, $name!')
|
||||
..close();
|
||||
},
|
||||
);
|
||||
2. Clone one of the following starter projects:
|
||||
* [Angel3 Basic Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-basic)
|
||||
* [Angel3 ORM Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-orm)
|
||||
* [Angel3 Graphql Template](https://github.com/dukefirehawk/boilerplates/tree/angel3-graphql)
|
||||
|
||||
// Pattern matching - only call this handler if the query value of `name` equals 'emoji'.
|
||||
app.get(
|
||||
'/greet',
|
||||
ioc((@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥'),
|
||||
);
|
||||
3. Run the project in development mode (*hot-reloaded* is enabled on file changes).
|
||||
|
||||
// Handle any other query value of `name`.
|
||||
app.get(
|
||||
'/greet',
|
||||
ioc((@Query('name') String name) => 'Hello, $name!'),
|
||||
);
|
||||
```bash
|
||||
dart --observe bin/dev.dart
|
||||
```
|
||||
|
||||
// Simple fallback to throw a 404 on unknown paths.
|
||||
app.fallback((req, res) {
|
||||
throw AngelHttpException.notFound(
|
||||
message: 'Unknown path: "${req.uri.path}"',
|
||||
);
|
||||
});
|
||||
4. Run the project in production mode (*hot-reloaded* is disabled).
|
||||
|
||||
var http = AngelHttp(app);
|
||||
var server = await http.startServer('127.0.0.1', 3000);
|
||||
var url = 'http://${server.address.address}:${server.port}';
|
||||
print('Listening at $url');
|
||||
print('Visit these pages to see Angel in action:');
|
||||
print('* $url/greet/bob');
|
||||
print('* $url/greet/?name=emoji');
|
||||
print('* $url/greet/?name=jack');
|
||||
print('* $url/nonexistent_page');
|
||||
}
|
||||
```
|
||||
```bash
|
||||
dart bin/prod.dart
|
||||
```
|
||||
|
||||
5. Run as docker. Edit and build the image with the provided `Dockerfile` file.
|
||||
|
||||
### Create a new project with Angel3 CLI
|
||||
|
||||
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)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/framework
|
||||
repository: https://github.com/dukefirehawk/angel
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue