Skip to content

Commit

Permalink
skill issue
Browse files Browse the repository at this point in the history
  • Loading branch information
altfoxie committed Nov 28, 2023
1 parent 9b63049 commit f67b5fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use axum::{
extract::DefaultBodyLimit,
routing::{get, post},
Router, Server,
};
Expand All @@ -10,8 +11,8 @@ mod container;
mod handlers;
mod templates;

const PATH: &str = "ushlepok.json";
const IMAGE_PATH: &str = "image.jpeg";
const PATH: &str = "data/ushlepok.json";
const IMAGE_PATH: &str = "data/image.jpeg";

#[derive(Clone)]
pub struct AppState {
Expand All @@ -21,6 +22,8 @@ pub struct AppState {

#[tokio::main]
async fn main() {
std::fs::create_dir_all("data").unwrap();

let hbs = templates::init_handlebars().unwrap();
let container = Container::new(std::path::Path::new(PATH), std::path::Path::new(IMAGE_PATH));
if let Err(e) = container.load() {
Expand All @@ -34,6 +37,7 @@ async fn main() {
.route("/add", post(handlers::add::post))
.route("/rules", get(handlers::rules::get))
.fallback(get(handlers::assets::get))
.layer(DefaultBodyLimit::max(1024 * 1024 * 10)) // 10 MB, TODO: only for /add
.with_state(AppState {
engine: Engine::from(hbs),
container,
Expand Down

0 comments on commit f67b5fa

Please sign in to comment.