Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load from assets static page #461

Open
PrzemyslawPluszowy opened this issue Nov 29, 2024 · 0 comments
Open

Can't load from assets static page #461

PrzemyslawPluszowy opened this issue Nov 29, 2024 · 0 comments

Comments

@PrzemyslawPluszowy
Copy link

PrzemyslawPluszowy commented Nov 29, 2024

Hello, i try to create plugin, one of task is run server with static page, i have problem to serve static file

  final int _port;
  final String _host;

  WebHttpServer({
    String host = '127.0.0.1',
    int port = 9091,
  })  : _port = port,
        _host = host;

  final _staticHandler = createAssetHandler(
      rootPath: 'assets/web/', defaultDocument: 'index.html');

  Future<void> start() async {
    log('HIVE VIEW CE: Starting HTTP Server');
    var handler = const Pipeline()
        .addMiddleware(corsHeaders())
        .addHandler(_staticHandler);

    await shelf_io.serve(
      handler,
      _host,
      _port,
    );
    log('HIVE VIEW CE: HTTP Server started on http://$_host:$_port');
  }
}```

server start but can't load index.html
i think problem is path because this is plugin with assets
@PrzemyslawPluszowy PrzemyslawPluszowy changed the title cant load from assets static page Cant load from assets static page Nov 29, 2024
@PrzemyslawPluszowy PrzemyslawPluszowy changed the title Cant load from assets static page Can't load from assets static page Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant