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

Regex with EmbeddedFilesEndpoint #896

Open
skrcka opened this issue Oct 13, 2024 · 0 comments
Open

Regex with EmbeddedFilesEndpoint #896

skrcka opened this issue Oct 13, 2024 · 0 comments
Labels
question Further information is requested

Comments

@skrcka
Copy link

skrcka commented Oct 13, 2024

I am nesting a React Application inside Poem app and need to serve it under all endpoints except for some

Working example:

#[derive(RustEmbed)]
#[folder = "frontend/dist"]
pub struct Frontend;

Server::new(TcpListener::bind(ip))
        .run(
            Route::new()
                .nest("/api/v1", api_service)
                .nest("/api/v1/docs", ui)
                .nest("/api/v1/openapi.json", specs)
                .at("/*", EmbeddedFilesEndpoint::<Frontend>::new())
                .with(AddData::new(pool.clone()))
                .with(JwtMiddleware)
                .with(Cors::new()),
        )
        .await

React app is correctly served when "/" url is accessed. However if I try to open /some_route I get 404 even tho the React application should know the route.

What I need is something like:
.at("/<.+>/*", EmbeddedFilesEndpoint::::new())

Basically I need to serve the frontend app under all endpoints expect for my custom ones that are used as backend, is that possible?

@skrcka skrcka added the question Further information is requested label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant