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

feat: add base base path for HTTP applications #76

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

radu-matei
Copy link
Member

@radu-matei radu-matei commented Feb 13, 2022

close #71
close #56

This commit updates the HTTP application configuration to allow setting
a per-application base path, which will be prepended to the routes
defined by individual components.

For example, if base = "/foo", and a component route = "/bar/...",
that component will handle incoming requests for /foo/bar/....

This is the first step in implementing #40.

See doc for the HTTP headers set.

Signed-off-by: Radu Matei radu.matei@fermyon.com

@radu-matei radu-matei changed the title feat: implement a Wagi HTTP executor feat: add base base path for HTTP applications Feb 13, 2022
crates/http/src/wagi.rs Outdated Show resolved Hide resolved
This commit adds the concept of an application base path, whose value
gets prefixed as the matched route for all components of the application.

This commit also adds default HTTP headers.

Signed-off-by: Radu Matei <radu.matei@fermyon.com>

Ok(res)
}

/// The HTTP executor trait.
/// All HTTP executors must implement this trait.
#[async_trait]
pub(crate) trait HttpExecutor: Clone + Send + Sync + 'static {
async fn execute(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we should refactor this, since the argument list keeps growing.

@radu-matei radu-matei merged commit ec5a000 into fermyon:main Feb 15, 2022
@radu-matei radu-matei deleted the http-base-path branch February 15, 2022 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Base path for HTTP applications Default HTTP headers
2 participants