Added routes to app
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -1,3 +1,21 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
mod html;
|
||||
mod pages;
|
||||
|
||||
use actix_web::{App, HttpServer};
|
||||
|
||||
use pages::{files::file, index};
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
let bind_address = "0.0.0.0:8080";
|
||||
if let Ok(server) =
|
||||
HttpServer::new(|| App::new().service(index).service(file)).bind(bind_address)
|
||||
{
|
||||
match server.run().await {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
eprintln!("An error occurred: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user