Skip to content

Commit 60bd1bc

Browse files
feat: Add support for (sub)domain routing
1 parent 8989aa2 commit 60bd1bc

File tree

377 files changed

+10338
-5969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+10338
-5969
lines changed

doc_examples/guide/cookies/request_cookies/project/src/blueprint.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ use pavex::f;
55
pub fn blueprint() -> Blueprint {
66
let mut bp = Blueprint::new();
77
CookieKit::new().register(&mut bp);
8-
bp.singleton(f!(<pavex::cookie::ProcessorConfig as std::default::Default>::default));
9-
bp.nest_at("/core", crate::core::blueprint());
10-
bp.nest_at("/multiple", crate::multiple::blueprint());
8+
bp.singleton(f!(
9+
<pavex::cookie::ProcessorConfig as std::default::Default>::default
10+
));
11+
bp.prefix("/core").nest(crate::core::blueprint());
12+
bp.prefix("/multiple").nest(crate::multiple::blueprint());
1113
bp
1214
}

doc_examples/guide/cookies/response_cookies/project/src/blueprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn blueprint() -> Blueprint {
88
bp.singleton(f!(
99
<pavex::cookie::ProcessorConfig as std::default::Default>::default
1010
));
11-
bp.nest_at("/core", crate::core::blueprint());
12-
bp.nest_at("/delete", crate::delete::blueprint());
11+
bp.prefix("/core").nest(crate::core::blueprint());
12+
bp.prefix("/delete").nest(crate::delete::blueprint());
1313
bp
1414
}

doc_examples/guide/errors/error_handlers/project/src/blueprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use pavex::blueprint::Blueprint;
22

33
pub fn blueprint() -> Blueprint {
44
let mut bp = Blueprint::new();
5-
bp.nest_at("/core", crate::core::blueprint());
6-
bp.nest_at("/universal", crate::universal::blueprint());
5+
bp.prefix("/core").nest(crate::core::blueprint());
6+
bp.prefix("/universal").nest(crate::universal::blueprint());
77
bp
88
}

doc_examples/guide/middleware/order/project/src/blueprint.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ use pavex::blueprint::Blueprint;
33
pub fn blueprint() -> Blueprint {
44
let mut bp = Blueprint::new();
55
bp.nest(crate::core::blueprint());
6-
bp.nest_at("/pre_only", crate::pre_only::blueprint());
7-
bp.nest_at("/post_only", crate::post_only::blueprint());
8-
bp.nest_at("/wrap_only", crate::wrap_only::blueprint());
9-
bp.nest_at("/pre_and_post", crate::pre_and_post::blueprint());
10-
bp.nest_at("/post_and_wrap", crate::post_and_wrap::blueprint());
11-
bp.nest_at("/pre_and_wrap", crate::pre_and_wrap::blueprint());
12-
bp.nest_at("/order1", crate::order1::blueprint());
13-
bp.nest_at("/order2", crate::order2::blueprint());
6+
bp.prefix("/pre_only").nest(crate::pre_only::blueprint());
7+
bp.prefix("/post_only").nest(crate::post_only::blueprint());
8+
bp.prefix("/wrap_only").nest(crate::wrap_only::blueprint());
9+
bp.prefix("/pre_and_post")
10+
.nest(crate::pre_and_post::blueprint());
11+
bp.prefix("/post_and_wrap")
12+
.nest(crate::post_and_wrap::blueprint());
13+
bp.prefix("/pre_and_wrap")
14+
.nest(crate::pre_and_wrap::blueprint());
15+
bp.prefix("/order1").nest(crate::order1::blueprint());
16+
bp.prefix("/order2").nest(crate::order2::blueprint());
1417
bp
1518
}

doc_examples/guide/middleware/post/project/src/blueprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ pub fn blueprint() -> Blueprint {
99
let mut bp = Blueprint::new();
1010
bp.request_scoped(f!(self::root_span));
1111
bp.nest(crate::core::blueprint());
12-
bp.nest_at("/fallible", crate::fallible::blueprint());
12+
bp.prefix("/fallible").nest(crate::fallible::blueprint());
1313
bp
1414
}

doc_examples/guide/middleware/pre/project/src/blueprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ use pavex::blueprint::Blueprint;
33
pub fn blueprint() -> Blueprint {
44
let mut bp = Blueprint::new();
55
bp.nest(crate::core::blueprint());
6-
bp.nest_at("/fallible", crate::fallible::blueprint());
6+
bp.prefix("/fallible").nest(crate::fallible::blueprint());
77
bp
88
}

doc_examples/guide/request_data/route_params/project-route_params_registration.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pavex::f;
55
66
pub fn blueprint() -> Blueprint {
77
let mut bp = Blueprint::new();
8-
bp.route(GET, "/users/:id" /* (1)! */, f!(super::handler));
8+
bp.route(GET, "/users/{id}" /* (1)! */, f!(super::handler));
99
bp
1010
}
1111
```

doc_examples/guide/request_data/route_params/project/src/raw_route_params/blueprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ use pavex::f;
44

55
pub fn blueprint() -> Blueprint {
66
let mut bp = Blueprint::new();
7-
bp.route(GET, "/room/:id", f!(super::handler));
7+
bp.route(GET, "/room/{id}", f!(super::handler));
88
bp
99
}

doc_examples/guide/request_data/route_params/project/src/route_params/blueprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ use pavex::f;
44

55
pub fn blueprint() -> Blueprint {
66
let mut bp = Blueprint::new();
7-
bp.route(GET, "/users/:id" /* (1)! */, f!(super::handler));
7+
bp.route(GET, "/users/{id}" /* (1)! */, f!(super::handler));
88
bp
99
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```rust title="src/catch_all/blueprint.rs" hl_lines="7"
2+
use pavex::blueprint::router::GET;
3+
use pavex::blueprint::Blueprint;
4+
use pavex::f;
5+
6+
pub fn bp() -> Blueprint {
7+
let mut bp = Blueprint::new();
8+
bp.domain("{*any}.pavex.dev").nest(sub_bp());
9+
bp
10+
}
11+
12+
fn sub_bp() -> Blueprint {
13+
let mut bp = Blueprint::new();
14+
bp.route(GET, "/", f!(super::index));
15+
// Other routes...
16+
bp
17+
}
18+
```

0 commit comments

Comments
 (0)