Publish static

This commit is contained in:
thomashii 2021-05-15 21:28:26 +08:00
parent 43640a56f1
commit 5dd45c73dc
11 changed files with 40 additions and 50 deletions

View file

@ -1,6 +1,10 @@
# static
[![Pub](https://img.shields.io/pub/v/angel_static.svg)](https://pub.dartlang.org/packages/angel_static)
[![build status](https://travis-ci.org/angel-dart/static.svg?branch=master)](https://travis-ci.org/angel-dart/static)
# angel3_static
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_static)
[![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/static/LICENSE)
Static server infrastructure for Angel.
@ -11,20 +15,20 @@ In `pubspec.yaml`:
```yaml
dependencies:
angel_static: ^2.0.0-alpha
angel3_static: ^4.0.0
```
# Usage
To serve files from a directory, you need to create a `VirtualDirectory`.
Keep in mind that `angel_static` uses `package:file` instead of `dart:io`.
Keep in mind that `angel3_static` uses `package:file` instead of `dart:io`.
```dart
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
main() async {
void main() async {
var app = Angel();
var fs = const LocalFileSystem();

View file

@ -1,6 +1,6 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
import 'package:logging/logging.dart';

View file

@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:io' show HttpDate;
import 'package:angel_framework/angel_framework.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:file/file.dart';
import 'virtual_directory.dart';

View file

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:file/file.dart';
import 'package:http_parser/http_parser.dart';
import 'package:path/path.dart' as p;
import 'package:range_header/range_header.dart';
import 'package:angel3_range_header/angel3_range_header.dart';
final RegExp _param = RegExp(r':([A-Za-z0-9_]+)(\((.+)\))?');
final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)');

View file

@ -1,36 +1,22 @@
name: angel_static
name: angel3_static
description: Static server middleware for Angel. Also capable of serving Range responses.
version: 4.0.0
homepage: https://github.com/dukefirehawk/angel
publish_to: none
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/static
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
range_header:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/range_header
angel3_framework: ^4.0.0
angel3_range_header: ^3.0.0
convert: ^3.0.0
crypto: ^3.0.1
file: ^6.1.0
http_parser: ^4.0.0
path: ^1.8.0
dev_dependencies:
angel_test:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/test
angel3_test: ^4.0.0
http: ^0.13.2
logging: ^1.0.1
matcher: ^0.12.10
pedantic: ^1.11.0
test: ^1.17.3
test: ^1.17.4

View file

@ -1,6 +1,6 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
import 'package:http/http.dart' show Client;
import 'package:logging/logging.dart';

View file

@ -1,6 +1,6 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
void main() async {

View file

@ -1,7 +1,7 @@
import 'dart:io' show HttpDate;
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:file/local.dart';
import 'package:http/http.dart' show Client;
import 'package:logging/logging.dart';

View file

@ -1,6 +1,6 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel_test/angel_test.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:angel3_test/angel3_test.dart';
import 'package:file/file.dart';
import 'package:file/local.dart';
import 'package:logging/logging.dart';

View file

@ -1,6 +1,6 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_static/angel_static.dart';
import 'package:angel_test/angel_test.dart';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_static/angel3_static.dart';
import 'package:angel3_test/angel3_test.dart';
import 'package:file/memory.dart';
import 'package:logging/logging.dart';
import 'package:test/test.dart';