aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-26 03:14:38 +0000
committerFuwn <[email protected]>2022-03-26 03:14:38 +0000
commit327c338786f1cca92c669adc5400997e2ad771dc (patch)
tree5ebe0912dc4da3fbe52abf31dd1f062acce0393d
parentfeat: working proof (diff)
downloadwindmark-327c338786f1cca92c669adc5400997e2ad771dc.tar.xz
windmark-327c338786f1cca92c669adc5400997e2ad771dc.zip
refactor(router): rename get to mount
-rw-r--r--examples/windmark.rs8
-rw-r--r--src/lib.rs6
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs
index 7ce515f..847f2c3 100644
--- a/examples/windmark.rs
+++ b/examples/windmark.rs
@@ -39,15 +39,15 @@ fn main() -> std::io::Result<()> {
})
.set_header(|_| "```\nART IS COOL\n```".to_string())
.set_footer(|_| "Copyright 2022".to_string())
- .get("/", |_| {
+ .mount("/", |_| {
"# INDEX\n\nWelcome!\n\n=> /test Test Page\n=> /time Unix Epoch\n"
.to_string()
})
- .get("/ip", |stream| {
+ .mount("/ip", |stream| {
{ format!("Hello, {}", stream.peer_addr().unwrap().ip()) }.into()
})
- .get("/test", |_| "hi there\n=> / back".to_string())
- .get("/time", |_| {
+ .mount("/test", |_| "hi there\n=> / back".to_string())
+ .mount("/time", |_| {
std::time::UNIX_EPOCH
.elapsed()
.unwrap()
diff --git a/src/lib.rs b/src/lib.rs
index de5693d..04e19a5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -105,10 +105,10 @@ impl Router {
///
/// ```rust
/// windmark::Router::new()
- /// .get("/", |_| "This is the index page!".into())
- /// .get("/test", |_| "This is a test page!".into());
+ /// .mount("/", |_| "This is the index page!".into())
+ /// .mount("/test", |_| "This is a test page!".into());
/// ```
- pub fn get(
+ pub fn mount(
&mut self,
route: &str,
handler: fn(&TcpStream) -> String,