not using handlers declared with routing macro should be detectable
- Lingua principale
- Rust
- Stelle
- 24.8k
- Fork
- 1.9k
- Merge medio
- 23h 10m
- PR unite (30g)
- 26
Descrizione
Hello,
I've been using actix-web for a while and it's working very well! There is one little thing that's been bothering me, though.
When I write services with actix-web I really like to use the macros for specifying method and path, as in the example below:
```rust
use actix_web::{get, web, App, HttpServer, Responder};
#[get("/hello/{name}")]
async fn greet(name: web::Path) -> impl Responder {
format!("Hello {name}!")
}
#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new().service(greet)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
```
I think it's great to have the path and method next to the implementation of the endpoint. However, nearly every time I add a new endpoint I forget to add the `service` to the app in when setting up the server, leading to a confused developer and a 404 when testing it out :)
I am not experienced enough with Rust's macro system to know if it's actually possible to do, but it would really be great if just using the macro could somehow add the service.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.