-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
32 lines (24 loc) · 783 Bytes
/
main.rs
File metadata and controls
32 lines (24 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// src/main.rs
mod map_segment;
mod web;
use std::sync::{Arc, RwLock};
use tower_http::cors::CorsLayer;
//use tracing_subscriber;
use map_segment::MapSegment;
use web::router;
#[tokio::main]
async fn main() {
// Set up logging
//tracing_subscriber::fmt::init();
// Load DEM dataset and generate the base image
let ms = MapSegment::load_from_dataset("USGS_13_n44w072_20240617.tif")
.expect("Failed to load dataset");
let ms = Arc::new(RwLock::new(ms));
// Build the application router
let app = router(ms).layer(CorsLayer::permissive());
// Start the Axum server
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000")
.await
.expect("Failed to bind listener");
axum::serve(listener, app).await.unwrap();
}