mirror of
https://github.com/actix/actix-website
synced 2025-06-27 07:29:02 +02:00
migrate to docusaurus (v2) (#266)
Co-authored-by: ibraheemdev <ibrah1440@gmail.com>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// <request-routing>
|
||||
use actix_web::{web, App, HttpRequest, HttpServer, Responder};
|
||||
use actix_web::{get, web, App, HttpRequest, HttpServer, Responder};
|
||||
|
||||
#[get("/")]
|
||||
async fn index(_req: HttpRequest) -> impl Responder {
|
||||
"Hello from the index page."
|
||||
}
|
||||
@ -13,8 +14,8 @@ async fn hello(path: web::Path<String>) -> impl Responder {
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.service(web::resource("/").to(index))
|
||||
.service(web::resource("/{name}").to(hello))
|
||||
.service(index)
|
||||
.route("/{name}", web::get().to(hello))
|
||||
})
|
||||
.bind(("127.0.0.1", 8080))?
|
||||
.run()
|
||||
|
Reference in New Issue
Block a user