mirror of
https://github.com/RGBCube/GDUS
synced 2025-07-28 21:47:45 +00:00
More code
This commit is contained in:
parent
6fb17a18c6
commit
8fb68a3b7a
3 changed files with 31 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
mod index;
|
||||
mod submit;
|
||||
mod view;
|
||||
|
||||
use std::io;
|
||||
|
||||
|
@ -33,6 +34,7 @@ async fn main() -> io::Result<()> {
|
|||
.service(index::index)
|
||||
.service(submit::submit)
|
||||
.service(submit::submit_form)
|
||||
.service(view::view);
|
||||
})
|
||||
.bind(("127.0.0.1", 80))?
|
||||
.run()
|
||||
|
|
|
@ -6,6 +6,7 @@ use actix_web::web::{
|
|||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
PreEscaped,
|
||||
DOCTYPE,
|
||||
};
|
||||
use sqlx::SqlitePool;
|
||||
|
@ -41,9 +42,9 @@ async fn submit_form(
|
|||
(DOCTYPE)
|
||||
h1 { "Kaydedildi." }
|
||||
p { "Ana sayfaya geri yönlendiriliyorsun..." }
|
||||
script type="text/javascript" {r#"
|
||||
setTimeout(() => window.location.href = "/", 5000);
|
||||
"#}
|
||||
script type="text/javascript" {(PreEscaped(r#"
|
||||
setTimeout(function() { window.location.href = "/"; }, 5000);
|
||||
"#))}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
25
src/view.rs
Normal file
25
src/view.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
use actix_web as web;
|
||||
use actix_web::web::{
|
||||
Data,
|
||||
Query,
|
||||
};
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
DOCTYPE,
|
||||
};
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[web::get("/")]
|
||||
async fn index(data: Data<SqlitePool>) -> web::Result<Markup> {
|
||||
sqlx::query_as::<(String, String)>(
|
||||
r"
|
||||
TODO
|
||||
",
|
||||
);
|
||||
|
||||
Ok(html! {
|
||||
(DOCTYPE)
|
||||
h1 { "Hello, World!" }
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue