Skip to content

Commit

Permalink
PUT implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusbuffett committed Oct 23, 2020
1 parent 1ede32c commit 0f562ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ fn delete_user(db: State<Database>, username: String) -> EndpointResult<Json<Use

#[put("/users", data = "<user>")]
fn put_user(db: State<Database>, user: Json<User>) -> EndpointResult<Json<User>> {
todo!()
db.users
.insert(user.username.as_bytes(), user.clone())
.unwrap();
Ok(Json(user.0))
}

fn main() {
Expand Down

0 comments on commit 0f562ab

Please sign in to comment.