Add rust implementation

This commit is contained in:
2022-12-14 22:33:38 +01:00
parent e36487b5ad
commit a5827721cd
39 changed files with 2473 additions and 1410 deletions

29
src/main.rs Normal file
View File

@@ -0,0 +1,29 @@
#[macro_use]
extern crate lazy_static;
pub mod config;
pub mod views;
pub mod services;
use std::net::SocketAddr;
use axum::{Router, routing::get};
use views::{download, get_filename};
#[tokio::main]
async fn main() {
env_logger::init();
let app = Router::new()
.route("/download/:source_id/:remote_id/:file_type", get(download))
.route("/filename/:book_id/:file_type", get(get_filename));
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
log::info!("Start webserver...");
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
log::info!("Webserver shutdown...")
}