You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1 KiB

2 years ago
mod action;
mod client;
mod form_data;
mod line;
mod options;
mod routes;
mod wot_log;
use actix_files::Files;
use actix_web::{middleware, web, App, HttpServer};
use handlebars::Handlebars;
use log::info;
use action::Action;
use client::Client;
use form_data::FormData;
//use line::Line;
use options::Options;
use wot_log::WotLog;
pub fn default_false() -> bool {
false
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let options = Options::init();
rag::init().unwrap();
let mut handlebars = Handlebars::new();
handlebars.register_templates_directory(".html", "./templates").unwrap();
let handlebars_ref = web::Data::new(handlebars);
info!("Configuration (see --help to change):");
info!("{:?}", options);
HttpServer::new(move || {
App::new()
.app_data(handlebars_ref.clone())
.wrap(middleware::Logger::default())
2 years ago
.service(routes::help::get)
2 years ago
.service(routes::index::get)
.service(routes::submit::get)
.service(routes::submit::post)
.service(Files::new("/static", "static").show_files_listing())
})
.bind((options.address, options.port))?
.workers(options.workers)
.run()
.await
}