From ff13d575632d9799243a43503a114fe54814e2c5 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sun, 10 Dec 2023 10:26:38 +0000 Subject: [PATCH] ini --- january/src/main.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 january/src/main.rs diff --git a/january/src/main.rs b/january/src/main.rs new file mode 100644 index 00000000..286ee28a --- /dev/null +++ b/january/src/main.rs @@ -0,0 +1,31 @@ +#[macro_use] +extern crate lazy_static; + +use actix_web::middleware::Logger; +use actix_web::{web, App, HttpServer}; +use log::info; +use util::variables::HOST; + +pub mod routes; +pub mod structs; +pub mod util; + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + dotenv::dotenv().ok(); + + env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "info")); + + info!("Starting January server."); + + HttpServer::new(|| { + App::new() + .wrap(Logger::default()) + .route("/", web::get().to(routes::info::get)) + .route("/embed", web::get().to(routes::embed::get)) + .route("/proxy", web::get().to(routes::proxy::get)) + }) + .bind(HOST.clone())? + .run() + .await +}