diff options
author | Shav Kinderlehrer <[email protected]> | 2024-04-06 09:27:12 -0400 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2024-04-06 09:33:57 -0400 |
commit | 6c44d2eeabedb9e90d10bc10fe4e791988919bf1 (patch) | |
tree | 06c5b9729b3e5cf5ba06d7dadeea3f390dfe3d79 | |
parent | 4c6b2c204283bd086c422e3fb66cd7ee8894df9f (diff) | |
download | chela-6c44d2eeabedb9e90d10bc10fe4e791988919bf1.tar.gz chela-6c44d2eeabedb9e90d10bc10fe4e791988919bf1.zip |
Edit pages
-rw-r--r-- | src/get.rs | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -11,8 +11,22 @@ use info_utils::prelude::*; use crate::ServerState; use crate::UrlRow; -pub async fn index() -> Html<&'static str> { - Html("hello, world!") +pub async fn index(Extension(state): Extension<ServerState>) -> Html<String> { + Html(format!( + r#" + <!DOCTYPE html> + <html> + <head> + <title>{} URL Shortener</title> + </head> + </html> + <body> + <pre>{} URL shortener</pre> + <a href="/create">create</a> + </body> + "#, + state.host, state.host + )) } /// # Panics @@ -128,12 +142,12 @@ pub async fn create_id(Extension(state): Extension<ServerState>) -> Html<String> URL to shorten: <input type="url" name="url" required> </label> - + <br /> <label for="id"> ID (optional): <input type="text" name="id"> </label> - + <br /> <input type="submit" value="create"> </form> </body> |