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

multiple folders as static directories #3402

Open
robjtede opened this issue Jun 14, 2024 Discussed in #3398 · 0 comments
Open

multiple folders as static directories #3402

robjtede opened this issue Jun 14, 2024 Discussed in #3398 · 0 comments
Labels
C-feature Category: new functionality d-medium Difficulty (estimate): Medium

Comments

@robjtede
Copy link
Member

robjtede commented Jun 14, 2024

Possible API

Files::new("/", ["./dist", "./public"])

Cavets

As noted in the discussion answers, this does make it hard to support options like show_index.

Discussed in #3398

Originally posted by Aobanana-chan June 10, 2024
For some reasons, I am migrating my website from Node.js/Fastify to Actix Web, but I am having some difficulties setting up static directories. I tried to mount two directories, "./public" and "./dist" to "/", but it failed.
Here is a simplified example code:

App::new()
            .service(Files::new("/", "./dist"))
            .service(Files::new("/", "./public"))

In the first service, if the file is not found, it directly responds with a 404 instead of moving to the next service. I realize this approach doesn't work.

@robjtede robjtede added C-feature Category: new functionality d-medium Difficulty (estimate): Medium labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: new functionality d-medium Difficulty (estimate): Medium
Projects
None yet
Development

No branches or pull requests

1 participant