```rs
use netron::prelude::*;
// GET EXAMPLE
#[axumhandler(method = "GET", path = "/api/hello")]
pub async fn hello_world() -> Result<String, AppError> {
Ok("world!".to_string())
}
// POST EXAMPLE
#[derive(Serialize, Debug, Deserialize, Clone)]
struct FooBar {
name: String,
count: u32,
}
#[axumhandler(method = "POST", path = "/api/foo")]
pub async fn test_sending(input: FooBar) -> Result<String, AppError> {
println!("{:#?}", input);
Ok("world!".to_string())
}
// MAIN SERVER
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenvy::dotenv().ok();
server_main().await?;
Ok(())
}
```
# GET example
```sh
# curl -sL localhost:4000/api/hello
"world!"
```
# POST example
```sh
curl -X POST http://localhost:4000/api/foo -H "Content-Type: application/json" -d '{"input": {"name": "rouan", "count": 40 }}'
```
Server console:
```log
2025-11-26T10:34:30.624989Z INFO http_request{method=POST uri=/api/foo version=HTTP/1.1}: netron::server: API call: POST /api/foo
FooBar {
name: "rouan",
count: 40,
}
2025-11-26T10:34:30.625154Z INFO http_request{method=POST uri=/api/foo version=HTTP/1.1}: netron::server: Response: status=200 OK latency=240.772µs
```