web服务加入静态资源支持

This commit is contained in:
2026-04-11 10:20:10 +08:00
parent 9735def8a6
commit 8c5aee049d
5 changed files with 50 additions and 6 deletions

View File

@@ -13,7 +13,8 @@ abstract class WebServer {
void start(int port,
{Response? Function(Request, Map<String, dynamic>)? interceptor,
Future<TokenResult> Function(String?)? tokenCheck});
Future<TokenResult> Function(String?)? tokenCheck,
StaticInfo? static});
void stop();
void addHandler(handler);
}
@@ -76,3 +77,9 @@ class TokenResult {
Map<String, dynamic>? payload;
TokenResult({required this.status, this.errMsg, this.payload});
}
class StaticInfo {
String path;
String root;
StaticInfo({this.path = "web", this.root = "index.html"});
}