changes to main
This commit is contained in:
parent
1b750c2cc0
commit
670c16a940
13
src/main.rs
13
src/main.rs
@ -1,6 +1,6 @@
|
|||||||
// relevant macros and imports for rocket.rs
|
// relevant macros and imports for rocket.rs
|
||||||
#[macro_use] extern crate rocket;
|
#[macro_use] extern crate rocket;
|
||||||
use rocket::{Rocket, Build, fs::{FileServer, relative}, serde::{Deserialize, json::Json}};
|
use rocket::{Rocket, Build, fs::{FileServer, relative}, serde::{Deserialize, json::Json}, Error, Response};
|
||||||
pub mod sql;
|
pub mod sql;
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
@ -25,17 +25,6 @@ struct PostTest<'r> {
|
|||||||
|
|
||||||
#[post("/post_test", data = "<test>")]
|
#[post("/post_test", data = "<test>")]
|
||||||
fn post_test(test: Json<PostTest<'_>>) {
|
fn post_test(test: Json<PostTest<'_>>) {
|
||||||
println!(
|
|
||||||
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
|
|
||||||
test.test_type,
|
|
||||||
test.test_length,
|
|
||||||
test.test_time,
|
|
||||||
test.test_seed,
|
|
||||||
test.quote_id,
|
|
||||||
test.wpm,
|
|
||||||
test.accuracy,
|
|
||||||
test.user_id
|
|
||||||
);
|
|
||||||
sql::post_test(test.test_type, test.test_length, test.test_time, test.test_seed, test.quote_id, test.wpm, test.accuracy, test.user_id)
|
sql::post_test(test.test_type, test.test_length, test.test_time, test.test_seed, test.quote_id, test.wpm, test.accuracy, test.user_id)
|
||||||
.expect("error in posting test to tests table");
|
.expect("error in posting test to tests table");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user