2024-09-23 01:44:59 +00:00
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:platform_container/mirrors.dart';
|
2024-12-14 18:55:13 +00:00
|
|
|
import 'package:platform_foundation/core.dart';
|
|
|
|
import 'package:platform_foundation/http.dart';
|
2024-09-23 01:44:59 +00:00
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
|
|
|
void main() async {
|
2024-09-28 23:14:48 +00:00
|
|
|
var app = Application(reflector: MirrorsReflector())
|
2024-09-23 20:35:32 +00:00
|
|
|
..logger = (Logger('protevus')
|
2024-09-23 01:44:59 +00:00
|
|
|
..onRecord.listen((rec) {
|
|
|
|
print(rec);
|
|
|
|
if (rec.error != null) print(rec.error);
|
|
|
|
if (rec.stackTrace != null) print(rec.stackTrace);
|
|
|
|
}))
|
|
|
|
..encoders.addAll({'gzip': gzip.encoder});
|
|
|
|
|
|
|
|
app.fallback(
|
|
|
|
(req, res) => Future.error('Throwing just because I feel like!'));
|
|
|
|
|
2024-09-28 23:14:48 +00:00
|
|
|
var http = PlatformHttp(app);
|
2024-09-23 01:44:59 +00:00
|
|
|
HttpServer? server = await http.startServer('127.0.0.1', 3000);
|
|
|
|
var url = 'http://${server.address.address}:${server.port}';
|
|
|
|
print('Listening at $url');
|
|
|
|
}
|