diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/main.rs b/src/main.rs index c3fcf91..859c4d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,27 +110,6 @@ impl DB { } } -#[derive(Debug, Serialize)] -struct TextResponse { - message: String -} -impl From<&'static str> for TextResponse { - fn from(value: &'static str) -> Self { - TextResponse{message: value.into()} - } -} - -#[derive(Debug, Deserialize)] -struct InputForm { - user: String, - password: String, -} -impl InputForm { - pub fn login(&self) -> bool { - self.user == self.password - } -} - #[get("/")] async fn index() -> &'static str { "This is a POKO server" @@ -179,17 +158,7 @@ async fn new_user(data: Json<UserForm>, db: &State<Mutex<DB>>) -> Json<Result<() } } -#[post("/", data="<body>", format="json")] -async fn posttest(body: Json<InputForm>) -> Json<TextResponse> { - println!("{:?}", body); - if body.login() { - TextResponse::from("Equal").into() - } else { - TextResponse::from("Not Equal").into() - } -} - #[launch] fn rocket() -> _ { - rocket::build().manage(Mutex::new(DB::load())).mount("/", routes![index, posttest, new_user, get_user]) + rocket::build().manage(Mutex::new(DB::load())).mount("/", routes![index, new_user, get_user]) }
\ No newline at end of file |