-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RouterBuilderLike
helper + fix sub sub router merging
- Loading branch information
1 parent
68aa9e1
commit c2d022c
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use rspc::{Router, RouterBuilderLike}; | ||
|
||
fn mount_inner() -> impl RouterBuilderLike<()> { | ||
Router::new().query("demo", |t| t(|ctx, _: ()| async move { "Hello World" })) | ||
} | ||
|
||
fn mount() -> impl RouterBuilderLike<()> { | ||
Router::<()>::new() | ||
.query("demo", |t| t(|ctx, _: ()| async move { "Hello World" })) | ||
.merge("inner.", mount_inner()) | ||
} | ||
|
||
fn main() { | ||
let r = Router::<(), ()>::new().merge("java.", mount()); | ||
|
||
// TODO: Hookup your router to a webserver like Axum or a Tauri desktop app using the Tauri IPC adapter. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters