From dd87f1bd5ddfbeb6a3c13b1015cf2ead402a24d2 Mon Sep 17 00:00:00 2001 From: Sangeeth Sudheer Date: Tue, 16 Aug 2022 14:50:39 +0530 Subject: [PATCH] gcd web p1 --- gcd-web/Cargo.toml | 10 ++++++++++ gcd-web/src/main.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 gcd-web/Cargo.toml create mode 100644 gcd-web/src/main.rs diff --git a/gcd-web/Cargo.toml b/gcd-web/Cargo.toml new file mode 100644 index 0000000..efb5b18 --- /dev/null +++ b/gcd-web/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "gcd-web" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +actix-web = "1.0.8" +serde = { version = "1.0", features = ["derive"] } \ No newline at end of file diff --git a/gcd-web/src/main.rs b/gcd-web/src/main.rs new file mode 100644 index 0000000..1f36a4f --- /dev/null +++ b/gcd-web/src/main.rs @@ -0,0 +1,28 @@ +use actix_web::{web, App, HttpResponse, HttpServer}; + +fn main() { + let server = HttpServer::new(|| { + App::new() + .route("/", web::get().to(get_index)) + }); + + println!("Serving on http://localhost:3300"); + + server.bind("127.0.0.1:3300").expect("error binding server to address") + .run().expect("error running server") +} + +fn get_index() -> HttpResponse { + HttpResponse::Ok() + .content_type("text/html") + .body( + r#" + GCD Calculator +
+ + + +
+ "#, + ) +} \ No newline at end of file