镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add an option for SPA #132

Open
Open

Description

@eruvanos

For single page applications it would be great to have a spa modus, which serves a default (often just index.html) page in case there is no matching file within the folder.

Example (old Python):
https://github.com/proxy/gist.github.com/jtangelder/e445e9a7f5e31c220be6

Activity

  1. FabioRosado commented on Feb 28, 2024

    @FabioRosado
    Contributor

    Hello I am going through the open issues and triaging them before we do another release of the CLI.

    Currently (in main) we have a pyscript run which runs a web server in a folder and serves whatever is there, even if index.html isn't available.

    Does this do what you expect or you mean something else?

  2. eruvanos commented on Feb 28, 2024

    @eruvanos
    Author

    Hi,
    to serve some SPA setups, it is required, to always serve index.html for any route, except for those which actually refer to an existing file to serve.

    This way the routing can use path based routing ("/") instead of "#/".

  3. FabioRosado commented on Feb 28, 2024

    @FabioRosado
    Contributor

    What exactly would you propose we change in the CLI for this?

  4. eruvanos commented on Feb 28, 2024

    @eruvanos
    Author

    Maybe a --default <file>.html parameter would be a good option, which always returns the given file if the requested path does not exist.

    So it would be flexible and would not be tied down to the SPA use case.

  5. FabioRosado commented on Feb 28, 2024

    @FabioRosado
    Contributor

    Ah I understand now 😄

    You can pass a path to pyscript run so for example assume you have a main.html you can do pyscript run main.html and it will serve that file as soon as the server starts. Will this address your use case? 🤔

  6. eruvanos commented on Mar 14, 2024

    @eruvanos
    Author

    No, it requires to always answer with the index file, if the path does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions