Updated angel3_shelf
This commit is contained in:
parent
4c426b76d2
commit
f624f87f96
21 changed files with 107 additions and 457 deletions
72
packages/.gitignore
vendored
72
packages/.gitignore
vendored
|
@ -1,72 +0,0 @@
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.dart_tool
|
|
||||||
.packages
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
|
|
||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
|
||||||
pubspec.lock
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
### Dart template
|
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
|
|
||||||
# SDK 1.20 and later (no longer creates packages directories)
|
|
||||||
|
|
||||||
# Older SDK versions
|
|
||||||
# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20)
|
|
||||||
.project
|
|
||||||
.buildlog
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
### JetBrains template
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
|
|
||||||
## VsCode
|
|
||||||
.vscode/
|
|
||||||
!.vscode/settings.json
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
.idea/
|
|
||||||
/out/
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
71
packages/pretty_logging/.gitignore
vendored
71
packages/pretty_logging/.gitignore
vendored
|
@ -1,71 +0,0 @@
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.dart_tool
|
|
||||||
.packages
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
|
|
||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
|
||||||
pubspec.lock
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
### Dart template
|
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
|
|
||||||
# SDK 1.20 and later (no longer creates packages directories)
|
|
||||||
|
|
||||||
# Older SDK versions
|
|
||||||
# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20)
|
|
||||||
.project
|
|
||||||
.buildlog
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
### JetBrains template
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
|
|
||||||
## VsCode
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
.idea/
|
|
||||||
/out/
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
72
packages/shelf/.gitignore
vendored
72
packages/shelf/.gitignore
vendored
|
@ -1,72 +0,0 @@
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.buildlog
|
|
||||||
.packages
|
|
||||||
.project
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
pubspec.lock
|
|
||||||
### JetBrains template
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/dictionaries
|
|
||||||
|
|
||||||
# Sensitive or high-churn files:
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.xml
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
|
|
||||||
# Gradle:
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# Mongo Explorer plugin:
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
.dart_tool
|
|
|
@ -1,12 +1,19 @@
|
||||||
# 3.0.0
|
# Change Log
|
||||||
* Migrated to support Dart SDK 2.12.x NNBD
|
|
||||||
|
## 3.0.0-dev.1
|
||||||
|
|
||||||
|
* Migrated to support Dart SDK 2.12.x NNBD
|
||||||
|
* Upgraded from `pendantic` to `lints` linter
|
||||||
|
|
||||||
|
## 2.1.0
|
||||||
|
|
||||||
# 2.1.0
|
|
||||||
* `pedantic` lints.
|
* `pedantic` lints.
|
||||||
* Add the `AngelShelf` driver class, which allows you to embed Angel within shelf.
|
* Add the `AngelShelf` driver class, which allows you to embed Angel within shelf.
|
||||||
|
|
||||||
# 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
* Removed `supportShelf`.
|
* Removed `supportShelf`.
|
||||||
|
|
||||||
# 1.2.0
|
## 1.2.0
|
||||||
|
|
||||||
* Upgraded for `>=1.1.0` compatibility.
|
* Upgraded for `>=1.1.0` compatibility.
|
|
@ -1,21 +1,29 @@
|
||||||
MIT License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2021 dukefirehawk.com
|
Copyright (c) 2021, dukefirehawk.com
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Redistribution and use in source and binary forms, with or without
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
modification, are permitted provided that the following conditions are met:
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
copies or substantial portions of the Software.
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
this list of conditions and the following disclaimer in the documentation
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
and/or other materials provided with the distribution.
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
contributors may be used to endorse or promote products derived from
|
||||||
SOFTWARE.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# shelf
|
# Angel3 Shelf
|
||||||
[![Pub](https://img.shields.io/pub/v/angel_shelf.svg)](https://pub.dartlang.org/packages/angel_shelf)
|
|
||||||
[![build status](https://travis-ci.org/angel-dart/shelf.svg)](https://travis-ci.org/angel-dart/shelf)
|
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_shelf?include_prereleases)
|
||||||
|
[![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/dart-backend/belatuk-common-utilities)](https://github.com/dukefirehawk/angel/tree/angel3/packages/shelf/LICENSE)
|
||||||
|
|
||||||
Shelf interop with Angel. This package lets you run `package:shelf` handlers via a custom adapter.
|
Shelf interop with Angel. This package lets you run `package:shelf` handlers via a custom adapter.
|
||||||
|
|
||||||
|
@ -11,26 +14,27 @@ having to rewrite your business logic.
|
||||||
This will make it easy to layer your API over a production application,
|
This will make it easy to layer your API over a production application,
|
||||||
rather than having to port code.
|
rather than having to port code.
|
||||||
|
|
||||||
- [Usage](#usage)
|
- [Angel3 Shelf](#angel3-shelf)
|
||||||
- [embedShelf](#embedshelf)
|
- [Usage](#usage)
|
||||||
- [Communicating with Angel](#communicating-with-angel-with-embedshelf)
|
- [embedShelf](#embedshelf)
|
||||||
- [`AngelShelf`](#angelshelf)
|
- [Communicating with Angel with embedShelf](#communicating-with-angel-with-embedshelf)
|
||||||
|
- [AngelShelf](#angelshelf)
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
|
|
||||||
## embedShelf
|
### embedShelf
|
||||||
|
|
||||||
This is a compliant `shelf` adapter that acts as an Angel request handler. You can use it as a middleware,
|
This is a compliant `shelf` adapter that acts as an Angel request handler. You can use it as a middleware,
|
||||||
or attach it to individual routes.
|
or attach it to individual routes.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_shelf/angel_shelf.dart';
|
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'api/api.dart';
|
import 'api/api.dart';
|
||||||
|
|
||||||
main() async {
|
void main() async {
|
||||||
var app = Angel();
|
var app = Angel();
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
|
|
||||||
|
@ -72,13 +76,10 @@ handleRequest(shelf.Request request) {
|
||||||
```
|
```
|
||||||
|
|
||||||
### AngelShelf
|
### AngelShelf
|
||||||
Angel 2 brought about the generic `Driver` class, which is implemented
|
|
||||||
by `AngelHttp`, `AngelHttp2`, `AngelGopher`, etc., and provides the core
|
|
||||||
infrastructure for request handling in Angel.
|
|
||||||
|
|
||||||
`AngelShelf` is an implementation that wraps shelf requests and responses in their
|
Angel 2 brought about the generic `Driver` class, which is implemented by `AngelHttp`, `AngelHttp2`, `AngelGopher`, etc., and provides the core infrastructure for request handling in Angel.
|
||||||
Angel equivalents. Using it is as simple using as using `AngelHttp`, or any other
|
|
||||||
driver:
|
`AngelShelf` is an implementation that wraps shelf requests and responses in their Angel equivalents. Using it is as simple using as using `AngelHttp`, or any other driver:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
// Create an AngelShelf driver.
|
// Create an AngelShelf driver.
|
||||||
|
|
|
@ -1,4 +1 @@
|
||||||
include: package:pedantic/analysis_options.yaml
|
include: package:lints/recommended.yaml
|
||||||
analyzer:
|
|
||||||
strong-mode:
|
|
||||||
implicit-casts: false
|
|
|
@ -1,9 +1,9 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_container/mirrors.dart';
|
import 'package:angel3_container/mirrors.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_shelf/angel_shelf.dart';
|
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:pretty_logging/pretty_logging.dart';
|
import 'package:angel3_pretty_logging/angel3_pretty_logging.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'package:shelf/shelf_io.dart' as shelf_io;
|
import 'package:shelf/shelf_io.dart' as shelf_io;
|
||||||
import 'package:shelf_static/shelf_static.dart';
|
import 'package:shelf_static/shelf_static.dart';
|
||||||
|
@ -15,7 +15,7 @@ void main() async {
|
||||||
|
|
||||||
// Create a basic Angel server, with some routes.
|
// Create a basic Angel server, with some routes.
|
||||||
var app = Angel(
|
var app = Angel(
|
||||||
logger: Logger('angel_shelf_demo'),
|
logger: Logger('angel3_shelf_demo'),
|
||||||
reflector: MirrorsReflector(),
|
reflector: MirrorsReflector(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel3_framework/http.dart';
|
||||||
import 'package:angel_shelf/angel_shelf.dart';
|
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:pretty_logging/pretty_logging.dart';
|
import 'package:angel3_pretty_logging/angel3_pretty_logging.dart';
|
||||||
import 'package:shelf_static/shelf_static.dart';
|
import 'package:shelf_static/shelf_static.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
@ -11,7 +11,7 @@ void main() async {
|
||||||
..level = Level.ALL
|
..level = Level.ALL
|
||||||
..onRecord.listen(prettyLog);
|
..onRecord.listen(prettyLog);
|
||||||
|
|
||||||
var app = Angel(logger: Logger('angel_shelf_demo'));
|
var app = Angel(logger: Logger('angel3_shelf_demo'));
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
|
|
||||||
// `shelf` request handler
|
// `shelf` request handler
|
||||||
|
@ -23,7 +23,7 @@ void main() async {
|
||||||
|
|
||||||
// A normal Angel route.
|
// A normal Angel route.
|
||||||
app.get('/angel', (req, ResponseContext res) {
|
app.get('/angel', (req, ResponseContext res) {
|
||||||
res.write('Hooray for `package:angel_shelf`!');
|
res.write('Hooray for `package:angel3_shelf`!');
|
||||||
return false; // End execution of handlers, so we don't proxy to dartlang.org when we don't need to.
|
return false; // End execution of handlers, so we don't proxy to dartlang.org when we don't need to.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'package:stream_channel/stream_channel.dart';
|
import 'package:stream_channel/stream_channel.dart';
|
||||||
|
|
||||||
/// Creates a [shelf.Request] analogous to the input [req].
|
/// Creates a [shelf.Request] analogous to the input [req].
|
||||||
///
|
///
|
||||||
/// The request's `context` will contain [req.container] as `angel_shelf.container`, as well as
|
/// The request's `context` will contain [req.container] as `angel3_shelf.container`, as well as
|
||||||
/// the provided [context], if any.
|
/// the provided [context], if any.
|
||||||
///
|
///
|
||||||
/// The context will also have the original request available as `angel_shelf.request`.
|
/// The context will also have the original request available as `angel3_shelf.request`.
|
||||||
///
|
///
|
||||||
/// If you want to read the request body, you *must* set `keepRawRequestBuffers` to `true`
|
/// If you want to read the request body, you *must* set `keepRawRequestBuffers` to `true`
|
||||||
/// on your application instance.
|
/// on your application instance.
|
||||||
|
@ -64,8 +64,8 @@ Future<shelf.Request> convertRequest(RequestContext req, ResponseContext res,
|
||||||
handlerPath: handlerPath,
|
handlerPath: handlerPath,
|
||||||
url: url,
|
url: url,
|
||||||
body: req.body,
|
body: req.body,
|
||||||
context: {'angel_shelf.request': req}
|
context: {'angel3_shelf.request': req}
|
||||||
..addAll({'angel_shelf.container': req.container!})
|
..addAll({'angel3_shelf.container': req.container!})
|
||||||
..addAll(context ?? {}),
|
..addAll(context ?? {}),
|
||||||
onHijack: onHijack);
|
onHijack: onHijack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'convert.dart';
|
import 'convert.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'package:shelf/shelf.dart';
|
import 'package:shelf/shelf.dart';
|
||||||
import 'shelf_request.dart';
|
import 'shelf_request.dart';
|
||||||
import 'shelf_response.dart';
|
import 'shelf_response.dart';
|
||||||
|
|
||||||
|
// TODO: To be reviewed
|
||||||
|
Future<Stream<Request>> process(dynamic param1, int param2) {
|
||||||
|
return Future.value();
|
||||||
|
}
|
||||||
|
|
||||||
class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
||||||
Stream<shelf.Request>, ShelfRequestContext, ShelfResponseContext> {
|
Stream<shelf.Request>, ShelfRequestContext, ShelfResponseContext> {
|
||||||
final StreamController<shelf.Request> incomingRequests = StreamController();
|
final StreamController<shelf.Request> incomingRequests = StreamController();
|
||||||
|
@ -14,7 +19,7 @@ class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
||||||
|
|
||||||
AngelShelf(Angel app, {FutureOr<shelf.Response> Function()? notFound})
|
AngelShelf(Angel app, {FutureOr<shelf.Response> Function()? notFound})
|
||||||
: notFound = notFound ?? (() => shelf.Response.notFound('Not Found')),
|
: notFound = notFound ?? (() => shelf.Response.notFound('Not Found')),
|
||||||
super(app, null, useZone: false) {
|
super(app, process, useZone: false) {
|
||||||
// Inject a final handler that will keep responses open, if we are using the
|
// Inject a final handler that will keep responses open, if we are using the
|
||||||
// driver as a middleware.
|
// driver as a middleware.
|
||||||
app.fallback((req, res) {
|
app.fallback((req, res) {
|
||||||
|
@ -25,8 +30,6 @@ class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Stream<Request>> aaa(dynamic param1, int param2) {}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() {
|
Future<void> close() {
|
||||||
incomingRequests.close();
|
incomingRequests.close();
|
||||||
|
@ -112,7 +115,7 @@ class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
||||||
shelf.Request request, ShelfResponseContext? response,
|
shelf.Request request, ShelfResponseContext? response,
|
||||||
[ShelfRequestContext? correspondingRequest]) {
|
[ShelfRequestContext? correspondingRequest]) {
|
||||||
// Return the original response.
|
// Return the original response.
|
||||||
return Future.value(response..correspondingRequest = correspondingRequest);
|
return Future.value(response!..correspondingRequest = correspondingRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_container/angel_container.dart';
|
import 'package:angel3_container/angel3_container.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:angel3_mock_request/angel3_mock_request.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
|
|
||||||
class ShelfRequestContext extends RequestContext {
|
class ShelfRequestContext extends RequestContext {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'shelf_request.dart';
|
import 'shelf_request.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,19 @@
|
||||||
name: angel_shelf
|
name: angel3_shelf
|
||||||
version: 3.0.0
|
version: 3.0.0-dev.1
|
||||||
description: Shelf interop with Angel. Use this to wrap existing server code.
|
description: Shelf interop with Angel3. Use this to wrap existing server code.
|
||||||
homepage: https://github.com/angel-dart/shelf
|
homepage: https://angel3-framework.web.app/
|
||||||
|
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/shelf
|
||||||
publish_to: none
|
publish_to: none
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_framework:
|
angel3_framework: ^4.1.0
|
||||||
git:
|
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
|
||||||
ref: sdk-2.12.x_nnbd
|
|
||||||
path: packages/framework
|
|
||||||
path: ^1.8.0
|
path: ^1.8.0
|
||||||
shelf: ^1.1.4
|
shelf: ^1.1.4
|
||||||
stream_channel: ^2.1.0
|
stream_channel: ^2.1.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
angel_test:
|
angel3_test: ^4.0.0
|
||||||
git:
|
angel3_pretty_logging: ^3.0.0
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
|
||||||
ref: sdk-2.12.x_nnbd
|
|
||||||
path: packages/test
|
|
||||||
pedantic: ^1.11.0
|
|
||||||
pretty_logging:
|
|
||||||
git:
|
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
|
||||||
ref: sdk-2.12.x_nnbd
|
|
||||||
path: packages/pretty_logging
|
|
||||||
shelf_static: ^1.0.0
|
shelf_static: ^1.0.0
|
||||||
test: ^1.17.7
|
test: ^1.17.7
|
||||||
|
lints: ^1.0.0
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel3_framework/http.dart';
|
||||||
import 'package:angel_shelf/angel_shelf.dart';
|
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||||
import 'package:angel_test/angel_test.dart';
|
import 'package:angel3_test/angel3_test.dart';
|
||||||
import 'package:charcode/charcode.dart';
|
import 'package:charcode/charcode.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:pretty_logging/pretty_logging.dart';
|
import 'package:angel3_pretty_logging/angel3_pretty_logging.dart';
|
||||||
import 'package:shelf/shelf.dart' as shelf;
|
import 'package:shelf/shelf.dart' as shelf;
|
||||||
import 'package:stream_channel/stream_channel.dart';
|
import 'package:stream_channel/stream_channel.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
@ -50,7 +50,7 @@ void main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var logger = Logger.detached('angel_shelf')..onRecord.listen(prettyLog);
|
var logger = Logger.detached('angel3_shelf')..onRecord.listen(prettyLog);
|
||||||
var app = Angel(logger: logger);
|
var app = Angel(logger: logger);
|
||||||
var httpDriver = AngelHttp(app);
|
var httpDriver = AngelHttp(app);
|
||||||
app.get('/angel', (req, res) => 'Angel');
|
app.get('/angel', (req, res) => 'Angel');
|
||||||
|
|
71
packages/static/.gitignore
vendored
71
packages/static/.gitignore
vendored
|
@ -1,71 +0,0 @@
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.dart_tool
|
|
||||||
.packages
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
|
|
||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
|
||||||
pubspec.lock
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
### Dart template
|
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
|
|
||||||
# SDK 1.20 and later (no longer creates packages directories)
|
|
||||||
|
|
||||||
# Older SDK versions
|
|
||||||
# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20)
|
|
||||||
.project
|
|
||||||
.buildlog
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
### JetBrains template
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
|
|
||||||
## VsCode
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
.idea/
|
|
||||||
/out/
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: angel3_static
|
name: angel3_static
|
||||||
description: This library provides a virtual directory to serve static files for Angel3 framework.
|
|
||||||
version: 4.1.0
|
version: 4.1.0
|
||||||
|
description: This library provides a virtual directory to serve static files for Angel3 framework.
|
||||||
homepage: https://angel3-framework.web.app/
|
homepage: https://angel3-framework.web.app/
|
||||||
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static
|
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static
|
||||||
environment:
|
environment:
|
||||||
|
|
71
packages/symbol_table/.gitignore
vendored
71
packages/symbol_table/.gitignore
vendored
|
@ -1,71 +0,0 @@
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.dart_tool
|
|
||||||
.packages
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
|
|
||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
|
||||||
pubspec.lock
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
### Dart template
|
|
||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
|
|
||||||
# SDK 1.20 and later (no longer creates packages directories)
|
|
||||||
|
|
||||||
# Older SDK versions
|
|
||||||
# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20)
|
|
||||||
.project
|
|
||||||
.buildlog
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
### JetBrains template
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
|
|
||||||
## VsCode
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
.idea/
|
|
||||||
/out/
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
|
@ -9,6 +9,7 @@ void main() async {
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
|
|
||||||
//TODO: To be reviewed
|
//TODO: To be reviewed
|
||||||
|
/*
|
||||||
app.get(
|
app.get(
|
||||||
'/',
|
'/',
|
||||||
waterfall([
|
waterfall([
|
||||||
|
@ -24,4 +25,5 @@ void main() async {
|
||||||
|
|
||||||
var server = await http.startServer(InternetAddress.anyIPv4, 3000);
|
var server = await http.startServer(InternetAddress.anyIPv4, 3000);
|
||||||
print('Listening at http://${server.address.address}:${server.port}');
|
print('Listening at http://${server.address.address}:${server.port}');
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue