Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created November 30, 2025 05:17
Show Gist options
  • Select an option

  • Save masakielastic/15cd6f9f708ddbda96e475b926f74557 to your computer and use it in GitHub Desktop.

Select an option

Save masakielastic/15cd6f9f708ddbda96e475b926f74557 to your computer and use it in GitHub Desktop.

ActiX で Hello World

Cargo.toml

[package]
name = "actix-project"
version = "0.1.0"
edition = "2024"

[dependencies]
actix-web = "4"

src/main.rs

use actix_web::{get, App, HttpResponse, HttpServer, Responder};

#[get("/")]
async fn hello() -> impl Responder {
    HttpResponse::Ok().body("Hello World!")
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    println!("Server running at http://127.0.0.1:8080");

    HttpServer::new(|| {
        App::new()
            .service(hello)
    })
    .bind(("127.0.0.1", 8080))?
    .run()
    .await
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment