Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swedesjs/middleware_dart
A platform for creating middleware inspired by middleware-io. It has many snippets and has no dependencies.
https://github.com/swedesjs/middleware_dart
Last synced: about 1 month ago
JSON representation
A platform for creating middleware inspired by middleware-io. It has many snippets and has no dependencies.
- Host: GitHub
- URL: https://github.com/swedesjs/middleware_dart
- Owner: swedesjs
- License: bsd-3-clause
- Created: 2024-01-03T22:08:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-03T22:13:30.000Z (about 1 year ago)
- Last Synced: 2024-01-04T22:34:10.907Z (about 1 year ago)
- Language: Dart
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
> **Middleware_Dart** - Library for middleware, inspired by [middleware-io](https://github.com/negezor/middleware-io)
# Features
1. **Self-sufficient.** The library has no dependencies
2. **Reliable.** The library is covered with tests
3. **Strong.** Supports the following additional features:
- The library has enough built-in snippets;
- Middleware chain designer;# Example Usage
```dart
import 'package:middleware_dart/middleware_dart.dart';void main() async {
final composedMiddleware = compose([
(context, next) async {
print('step 1');
await next();
print('step 4');
},
(context, next) async {
print('step 2');
await next();
print('step 3');
}
]);await composedMiddleware([], () {
print('Middleware finished work');
});
}
```