use actix_web::{get, web, App, HttpServer, Responder}; #[get("/hello/{name}")] async fn greet(name: web::Path<String>) -> impl Responder { format!("Hello {name}!") } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new().service(greet) }) .bind(("127.0.0.1", 8080))? .run() .await }
from sanic import Sanic from sanic.request import Request from sanic.response import text, HTTPResponse app = Sanic("MyHelloWorldApp") @app.get("/hello/<name>") async def hello_world(request: Request, name: str) -> HTTPResponse: return text(f"Hello, {name}")