2024-05-02 23:24:52 +00:00
|
|
|
use actix_web::{App, get, HttpResponse, HttpServer, Responder};
|
|
|
|
|
2024-05-02 23:33:47 +00:00
|
|
|
mod util;
|
|
|
|
|
2024-05-02 23:24:52 +00:00
|
|
|
#[actix_web::main]
|
|
|
|
async fn main() -> std::io::Result<()> {
|
2024-05-02 23:33:47 +00:00
|
|
|
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))
|
2024-05-02 23:33:47 +00:00
|
|
|
.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
|
|
|
}
|