Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dizoftteam/dart_side
Simple and Pure Dart Http Server
https://github.com/dizoftteam/dart_side
dart http http-server
Last synced: 25 days ago
JSON representation
Simple and Pure Dart Http Server
- Host: GitHub
- URL: https://github.com/dizoftteam/dart_side
- Owner: DizoftTeam
- License: mit
- Created: 2021-03-23T12:41:18.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-26T18:39:53.000Z (over 3 years ago)
- Last Synced: 2024-10-01T16:39:41.727Z (about 1 month ago)
- Topics: dart, http, http-server
- Language: Dart
- Homepage: https://pub.dev/packages/dart_side/score
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Dart Side
![](https://badgen.net/github/release/DizoftTeam/dart_side)
![](https://badgen.net/github/stars/DizoftTeam/dart_side)
![](https://badgen.net/github/forks/DizoftTeam/dart_side)
![](https://badgen.net/github/issues/DizoftTeam/dart_side)
![](https://badgen.net/github/open-issues/DizoftTeam/dart_side)
![](https://badgen.net/github/license/DizoftTeam/dart_side)
![](https://badgen.net/github/tag/DizoftTeam/dart_side)
![](https://badgen.net/pub/v/dart_side)
![](https://badgen.net/pub/likes/dart_side)
![](https://badgen.net/pub/points/dart_side)
![](https://badgen.net/pub/popularity/dart_side)
![](https://badgen.net/pub/sdk-version/dart_side)Simple and Pure Dart Http server
## Usage
A simple usage example:
```dart
import 'dart:io';import 'package:dart_side/dart_side.dart';
Future main() async {
final HttpServer server = await HttpServer.bind(
InternetAddress.loopbackIPv4,
4040,
);print('Listening on localhost:${server.port}');
final DServer handler = new DServer();
handler.handle(
method: Method.GET,
handler: Handler(
path: '/v1/schedules',
callback: () {
// Somthing like Paginate list
return {
'items': [
'schedule 1',
'schedule 2',
'schedule 3',
'schedule 4',
'schedule 5',
],
};
},
),
);handler.handle(
method: Method.GET,
handler: Handler(
rPath: r'/v1/schedules/\d+',
callback: () {
return {
'read': 'schedule',
'id': -1,
};
},
),
);await for (HttpRequest request in server) {
await handler.serve(request);
}
}
```## Features and bugs
Please file feature requests and bugs at the [issue tracker](https://github.com/DizoftTeam/dart_side/issues).