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
|
||||
* Migrated to support Dart SDK 2.12.x NNBD
|
||||
# Change Log
|
||||
|
||||
## 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.
|
||||
* Add the `AngelShelf` driver class, which allows you to embed Angel within shelf.
|
||||
|
||||
# 2.0.0
|
||||
## 2.0.0
|
||||
|
||||
* Removed `supportShelf`.
|
||||
|
||||
# 1.2.0
|
||||
* Upgraded for `>=1.1.0` compatibility.
|
||||
## 1.2.0
|
||||
|
||||
* 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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
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:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
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,8 +1,11 @@
|
|||
# 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)
|
||||
# Angel3 Shelf
|
||||
|
||||
Shelf interop with Angel. This package lets you run `package:shelf` handlers via a custom adapter.
|
||||
![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.
|
||||
|
||||
Use the code in this repo to embed existing Angel/shelf apps into
|
||||
other Angel/shelf applications. This way, you can migrate legacy applications without
|
||||
|
@ -11,26 +14,27 @@ having to rewrite your business logic.
|
|||
This will make it easy to layer your API over a production application,
|
||||
rather than having to port code.
|
||||
|
||||
- [Usage](#usage)
|
||||
- [embedShelf](#embedshelf)
|
||||
- [Communicating with Angel](#communicating-with-angel-with-embedshelf)
|
||||
- [`AngelShelf`](#angelshelf)
|
||||
- [Angel3 Shelf](#angel3-shelf)
|
||||
- [Usage](#usage)
|
||||
- [embedShelf](#embedshelf)
|
||||
- [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,
|
||||
or attach it to individual routes.
|
||||
|
||||
```dart
|
||||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_shelf/angel_shelf.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||
import 'package:shelf/shelf.dart' as shelf;
|
||||
import 'api/api.dart';
|
||||
|
||||
main() async {
|
||||
void main() async {
|
||||
var app = Angel();
|
||||
var http = AngelHttp(app);
|
||||
|
||||
|
@ -72,13 +76,10 @@ handleRequest(shelf.Request request) {
|
|||
```
|
||||
|
||||
### 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 equivalents. Using it is as simple using as using `AngelHttp`, or any other
|
||||
driver:
|
||||
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 equivalents. Using it is as simple using as using `AngelHttp`, or any other driver:
|
||||
|
||||
```dart
|
||||
// Create an AngelShelf driver.
|
||||
|
@ -102,4 +103,4 @@ matched), the next shelf handler will be called.
|
|||
var handler = shelf.Pipeline()
|
||||
.addMiddleware(angelShelf.middleware)
|
||||
.addHandler(createStaticHandler(...));
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
include: package:pedantic/analysis_options.yaml
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
include: package:lints/recommended.yaml
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:io';
|
||||
import 'package:angel_container/mirrors.dart';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_shelf/angel_shelf.dart';
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_shelf/angel3_shelf.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_io.dart' as shelf_io;
|
||||
import 'package:shelf_static/shelf_static.dart';
|
||||
|
@ -15,7 +15,7 @@ void main() async {
|
|||
|
||||
// Create a basic Angel server, with some routes.
|
||||
var app = Angel(
|
||||
logger: Logger('angel_shelf_demo'),
|
||||
logger: Logger('angel3_shelf_demo'),
|
||||
reflector: MirrorsReflector(),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_framework/http.dart';
|
||||
import 'package:angel_shelf/angel_shelf.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
import 'package:angel3_shelf/angel3_shelf.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';
|
||||
|
||||
void main() async {
|
||||
|
@ -11,7 +11,7 @@ void main() async {
|
|||
..level = Level.ALL
|
||||
..onRecord.listen(prettyLog);
|
||||
|
||||
var app = Angel(logger: Logger('angel_shelf_demo'));
|
||||
var app = Angel(logger: Logger('angel3_shelf_demo'));
|
||||
var http = AngelHttp(app);
|
||||
|
||||
// `shelf` request handler
|
||||
|
@ -23,7 +23,7 @@ void main() async {
|
|||
|
||||
// A normal Angel route.
|
||||
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.
|
||||
});
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import 'dart:async';
|
||||
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:shelf/shelf.dart' as shelf;
|
||||
import 'package:stream_channel/stream_channel.dart';
|
||||
|
||||
/// 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 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`
|
||||
/// on your application instance.
|
||||
|
@ -64,8 +64,8 @@ Future<shelf.Request> convertRequest(RequestContext req, ResponseContext res,
|
|||
handlerPath: handlerPath,
|
||||
url: url,
|
||||
body: req.body,
|
||||
context: {'angel_shelf.request': req}
|
||||
..addAll({'angel_shelf.container': req.container!})
|
||||
context: {'angel3_shelf.request': req}
|
||||
..addAll({'angel3_shelf.container': req.container!})
|
||||
..addAll(context ?? {}),
|
||||
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 'convert.dart';
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
import 'dart:async';
|
||||
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';
|
||||
import 'shelf_request.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?,
|
||||
Stream<shelf.Request>, ShelfRequestContext, ShelfResponseContext> {
|
||||
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})
|
||||
: 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
|
||||
// driver as a middleware.
|
||||
app.fallback((req, res) {
|
||||
|
@ -25,8 +30,6 @@ class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
|||
});
|
||||
}
|
||||
|
||||
Future<Stream<Request>> aaa(dynamic param1, int param2) {}
|
||||
|
||||
@override
|
||||
Future<void> close() {
|
||||
incomingRequests.close();
|
||||
|
@ -112,7 +115,7 @@ class AngelShelf extends Driver<shelf.Request, ShelfResponseContext?,
|
|||
shelf.Request request, ShelfResponseContext? response,
|
||||
[ShelfRequestContext? correspondingRequest]) {
|
||||
// Return the original response.
|
||||
return Future.value(response..correspondingRequest = correspondingRequest);
|
||||
return Future.value(response!..correspondingRequest = correspondingRequest);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:angel_container/angel_container.dart';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:mock_request/mock_request.dart';
|
||||
import 'package:angel3_container/angel3_container.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_mock_request/angel3_mock_request.dart';
|
||||
import 'package:shelf/shelf.dart' as shelf;
|
||||
|
||||
class ShelfRequestContext extends RequestContext {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
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 'shelf_request.dart';
|
||||
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
name: angel_shelf
|
||||
version: 3.0.0
|
||||
description: Shelf interop with Angel. Use this to wrap existing server code.
|
||||
homepage: https://github.com/angel-dart/shelf
|
||||
name: angel3_shelf
|
||||
version: 3.0.0-dev.1
|
||||
description: Shelf interop with Angel3. Use this to wrap existing server code.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/shelf
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
dependencies:
|
||||
angel_framework:
|
||||
git:
|
||||
url: https://github.com/dukefirehawk/angel.git
|
||||
ref: sdk-2.12.x_nnbd
|
||||
path: packages/framework
|
||||
angel3_framework: ^4.1.0
|
||||
path: ^1.8.0
|
||||
shelf: ^1.1.4
|
||||
stream_channel: ^2.1.0
|
||||
dev_dependencies:
|
||||
angel_test:
|
||||
git:
|
||||
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
|
||||
angel3_test: ^4.0.0
|
||||
angel3_pretty_logging: ^3.0.0
|
||||
shelf_static: ^1.0.0
|
||||
test: ^1.17.7
|
||||
lints: ^1.0.0
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_framework/http.dart';
|
||||
import 'package:angel_shelf/angel_shelf.dart';
|
||||
import 'package:angel_test/angel_test.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
import 'package:angel3_shelf/angel3_shelf.dart';
|
||||
import 'package:angel3_test/angel3_test.dart';
|
||||
import 'package:charcode/charcode.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
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:stream_channel/stream_channel.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 httpDriver = AngelHttp(app);
|
||||
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
|
||||
description: This library provides a virtual directory to serve static files for Angel3 framework.
|
||||
version: 4.1.0
|
||||
description: This library provides a virtual directory to serve static files for Angel3 framework.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static
|
||||
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);
|
||||
|
||||
//TODO: To be reviewed
|
||||
/*
|
||||
app.get(
|
||||
'/',
|
||||
waterfall([
|
||||
|
@ -24,4 +25,5 @@ void main() async {
|
|||
|
||||
var server = await http.startServer(InternetAddress.anyIPv4, 3000);
|
||||
print('Listening at http://${server.address.address}:${server.port}');
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue