personal-tracker/server/src/main.rs

24 lines
521 B
Rust
Raw Normal View History

2024-05-02 23:24:52 +00:00
use actix_web::{App, get, HttpResponse, HttpServer, Responder};
mod util;
2024-05-02 23:24:52 +00:00
#[actix_web::main]
async fn main() -> std::io::Result<()> {
util::print_copyright_notice();
let port = 8000;
let bind_addr = "127.0.0.1";
util::notice_println(format!("Starting server on {}:{}", bind_addr, port));
2024-05-02 23:24:52 +00:00
HttpServer::new(|| App::new().service(hello))
.bind((bind_addr, port))?
2024-05-02 23:24:52 +00:00
.run()
.await
}
#[get("/")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("Hello World!")
2024-05-02 23:04:52 +00:00
}