2021-05-15 13:28:26 +00:00
|
|
|
import 'package:angel3_framework/angel3_framework.dart';
|
|
|
|
import 'package:angel3_framework/http.dart';
|
|
|
|
import 'package:angel3_static/angel3_static.dart';
|
2017-09-23 21:57:54 +00:00
|
|
|
import 'package:file/local.dart';
|
2017-02-27 00:19:34 +00:00
|
|
|
|
2021-05-01 03:53:04 +00:00
|
|
|
void main() async {
|
2024-10-12 10:35:14 +00:00
|
|
|
Protevus app;
|
|
|
|
ProtevusHttp http;
|
2021-05-01 03:53:04 +00:00
|
|
|
var testDir = const LocalFileSystem().directory('test');
|
2024-10-12 10:35:14 +00:00
|
|
|
app = Protevus();
|
|
|
|
http = ProtevusHttp(app);
|
2017-02-27 00:19:34 +00:00
|
|
|
|
2018-08-28 14:58:28 +00:00
|
|
|
app.fallback(
|
2019-05-02 23:29:09 +00:00
|
|
|
CachingVirtualDirectory(app, const LocalFileSystem(),
|
2017-09-23 21:57:54 +00:00
|
|
|
source: testDir,
|
|
|
|
maxAge: 350,
|
|
|
|
onlyInProduction: false,
|
|
|
|
indexFileNames: ['index.txt']).handleRequest,
|
|
|
|
);
|
2017-02-27 00:19:34 +00:00
|
|
|
|
2018-08-28 14:58:28 +00:00
|
|
|
app.get('*', (req, res) => 'Fallback');
|
2017-02-27 00:19:34 +00:00
|
|
|
|
|
|
|
app.dumpTree(showMatchers: true);
|
|
|
|
|
2018-07-09 17:38:22 +00:00
|
|
|
var server = await http.startServer();
|
2017-09-23 21:57:54 +00:00
|
|
|
print('Open at http://${server.address.host}:${server.port}');
|
2017-02-27 00:19:34 +00:00
|
|
|
}
|