Giter VIP home page Giter VIP logo

Comments (2)

alice-werefox avatar alice-werefox commented on May 27, 2024 1

Thank you for the feedback!

I can confirm, from referencing the axum-router example, and the Dioxus fullstack config source code, I was able to create this snippet:

    let cfg = server_only!(
        dioxus::fullstack::Config::new().addr(std::net::SocketAddr::from(([0, 0, 0, 0], 8234)))
    );

    LaunchBuilder::fullstack()
        .with_cfg(cfg)
        .launch(info_app::DioxusApp);

This will result in a built binary that will listen on 0.0.0.0:8234, which resolves the issue.

I would request that there be more consistent documentation on this, if possible. It's at the best slightly confusing to imply that fullstack's listen parameters can be changed with a --port flag. There does not seem to be any mention of how to do this, so without knowing where to look, and what to look for, it would be reasonable to assume someone in a similar position may just assume it isn't possible altogether.

Fullstack builds a separate server binary that renders the app on the server and serves static files. That server uses a default port of 8080 that can be changed in the fullstack config.

At the very least, it would be good to mention this somewhere, and possibly take code snippets from the examples to show how you would change it.

If you are interested in working on this issue, we could introduce a new struct in the cli-config library that has runtime settings for dioxus like --port. When we run the CLI, we could set the environment variable like DIOXUS_ARGUMENTS and then read it inside the fullstack server to provide a better default port value

I have no problem with taking a look at this myself, but I am going to be a little busy the next week or so. I think that one of two (or both) solutions would be the best option moving forward with this:

  • Make it clear where an addr and/or port value could be added to an existing Dioxus.toml to be forwarded to a compiled binary in fullstack
  • Add a cli flag as you suggested that would do the same

Both approaches I think have decent merit, and achieve the same goal.

from dioxus.

ealmloff avatar ealmloff commented on May 27, 2024

Fullstack builds a separate server binary that renders the app on the server and serves static files. That server uses a default port of 8080 that can be changed in the fullstack config.

The dioxus-cli currently only forwards information in the dioxus.toml config to applications with the DIOXUS_CONFIG environment variable (here). We need to also forward some CLI args like --port

If you are interested in working on this issue, we could introduce a new struct in the cli-config library that has runtime settings for dioxus like --port. When we run the CLI, we could set the environment variable like DIOXUS_ARGUMENTS and then read it inside the fullstack server to provide a better default port value

from dioxus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.