初始化项目

This commit is contained in:
2026-03-12 21:24:49 +08:00
commit c2b9c5d4c0
67 changed files with 8659 additions and 0 deletions

23
bin/server.dart Normal file
View File

@@ -0,0 +1,23 @@
import 'dart:io';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart';
import 'router.dart';
import 'middleware/exception_handler.dart';
void main(List<String> args) async {
// Use any available host or container IP (usually `0.0.0.0`).
final ip = InternetAddress.anyIPv4;
// Configure a pipeline that logs requests and handles exceptions.
final handler = Pipeline()
.addMiddleware(logRequests())
.addMiddleware(exceptionHandler())
.addHandler(createRouter().call);
// For running in containers, we respect the PORT environment variable.
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await serve(handler, ip, port);
print('Server listening on port ${server.port}');
}