-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔥 Invalid macro temporarily removed.
- Loading branch information
Showing
4 changed files
with
36 additions
and
94 deletions.
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 |
---|---|---|
@@ -1,51 +1,51 @@ | ||
#[cfg(test)] | ||
mod test { | ||
use hikari_proto::generate_app; | ||
// use hikari_proto::generate_app; | ||
|
||
fn generate() { | ||
generate_app! { | ||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
pub enum Route { | ||
#[at("/")] | ||
Portal { recommend_list: Vec<String> } | ||
|
||
#[at("/u/:id")] | ||
Personal { id: String, name: String, email: String } | ||
|
||
#[at("/t/:id")] | ||
Thread { id: String, title: String, content: String, comments: Vec<String> } | ||
|
||
#[not_found] | ||
#[at("/404")] | ||
NotFound | ||
} | ||
|
||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
pub struct Theme { | ||
pub primary_color: String, | ||
pub secondary_color: String, | ||
} | ||
|
||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
pub struct UserToken { | ||
pub token: String, | ||
} | ||
} | ||
// generate_app! { | ||
// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
// pub enum Route { | ||
// #[at("/")] | ||
// Portal { recommend_list: Vec<String> } | ||
|
||
// #[at("/u/:id")] | ||
// Personal { id: String, name: String, email: String } | ||
|
||
// #[at("/t/:id")] | ||
// Thread { id: String, title: String, content: String, comments: Vec<String> } | ||
|
||
// #[not_found] | ||
// #[at("/404")] | ||
// NotFound | ||
// } | ||
|
||
// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
// pub struct Theme { | ||
// pub primary_color: String, | ||
// pub secondary_color: String, | ||
// } | ||
|
||
// #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
// pub struct UserToken { | ||
// pub token: String, | ||
// } | ||
// } | ||
} | ||
|
||
#[test] | ||
fn render_at_client() { | ||
generate().hydrate(web_sys::window()?.document()?.get_element_by_id("_root")?); | ||
// generate().hydrate(web_sys::window()?.document()?.get_element_by_id("_root")?); | ||
} | ||
|
||
#[test] | ||
fn render_at_server() { | ||
generate().render_to_string(Route::Personal { | ||
id: "114514", | ||
name: "homo", | ||
email: "[email protected]", | ||
}); | ||
// generate().render_to_string(Route::Personal { | ||
// id: "114514", | ||
// name: "homo", | ||
// email: "[email protected]", | ||
// }); | ||
|
||
let stream = generate().render_to_stream(); | ||
// let stream = generate().render_to_stream(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
mod macros; | ||
|
||
pub use macros::generate_app::*; | ||
pub use macros::register_routes::*; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
pub mod generate_app; | ||
pub mod register_routes; |