Edit pages

This commit is contained in:
Shav Kinderlehrer 2024-04-06 09:27:12 -04:00
parent 4c6b2c2042
commit 6c44d2eeab

View File

@ -11,8 +11,22 @@ use info_utils::prelude::*;
use crate::ServerState; use crate::ServerState;
use crate::UrlRow; use crate::UrlRow;
pub async fn index() -> Html<&'static str> { pub async fn index(Extension(state): Extension<ServerState>) -> Html<String> {
Html("hello, world!") 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 /// # Panics
@ -128,12 +142,12 @@ pub async fn create_id(Extension(state): Extension<ServerState>) -> Html<String>
URL to shorten: URL to shorten:
<input type="url" name="url" required> <input type="url" name="url" required>
</label> </label>
<br />
<label for="id"> <label for="id">
ID (optional): ID (optional):
<input type="text" name="id"> <input type="text" name="id">
</label> </label>
<br />
<input type="submit" value="create"> <input type="submit" value="create">
</form> </form>
</body> </body>