Skip to navigation
In Axum get a get parameter
28.08.25
In Axum get a get parameter ``` use axum::{extract::Query, response::IntoResponse, Json}; use std::collections::HashMap; use std::process::Command; pub async fn nslookup(Query(params): Query
>) -> impl IntoResponse { // http://127.0.0.1:8889/test //println!("{:?}", ip); if params.contains_key("domain") { let _domain = params["domain"].replace(" ", ""); } let output = Command::new("sh") .arg("-c") .arg("nslookup -type=txt baeckerei-katz.de") .output() .expect("Failed to execute command"); let r = serde_json::json!([ { "name": String::from_utf8_lossy(output.stdout.as_slice()), } ]); Json(r) } ```
https://www.programmerall.com/article/19292432258/
Reply
Anonymous
Information Epoch 1759908484
Make each program do one thing well.
Home
Notebook
Contact us