Closed develocode777 closed 7 months ago
Pipeline().addHandler(
is not needed. It's a bit redundant.
I should absolutely be possible to do what you're doing.
Pipeline().addHandler(
is not needed. It's a bit redundant.I should absolutely be possible to do what you're doing.
But it does not work, can you please provide an example?
Does it work with one?
I tried with this code:
final ip = InternetAddress.anyIPv4;
final router = Router()
..get('/one', createStaticHandler('../one', defaultDocument: 'index.html'))
..get('/two', createStaticHandler('../two', defaultDocument: 'index.html'));
// For running in containers, we respect the PORT environment variable.
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await io.serve(router, ip, port);
print('Server listening on port ${server.port}');
on both routes it says "Not Found", if instead of ..get('/one',
I do ..get('/',
then it works for one not for two
Actually even for a single folder it does not work if route is other than /
final ip = InternetAddress.anyIPv4;
final router = Router()
..get(
'/one',
createStaticHandler('../one',
defaultDocument: 'index.html'));
// For running in containers, we respect the PORT environment variable.
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await io.serve(router, ip, port);
print('Server listening on port ${server.port}');
Maybe go to
https://discord.com/channels/420324994703163402/825210836003323904
I don't have access on that link
Start here: https://discord.gg/rflutterdev
Is it possible to serve different static files on different routes? This is what I've tried but it does not work: