refactor: moving example away from admin, preparing more repository examples

This commit is contained in:
Gabor Körber 2024-01-28 21:00:02 +01:00
parent 0e6649de1b
commit e8ddfb25fa
4 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,6 @@ use axum::{routing::get, routing::post, Router};
use crate::state::AppState; use crate::state::AppState;
pub mod domain; pub mod domain;
pub mod example;
pub mod state; pub mod state;
pub mod views; pub mod views;

View File

@ -0,0 +1 @@
pub mod static_repository;

View File

@ -1,7 +1,7 @@
// implementation of static repository // implementation of static repository
use super::domain::*; use crate::admin::domain::*;
use super::state::AdminRegistry; use crate::admin::state::AdminRegistry;
use log::{debug, warn}; use log::{debug, warn};
use serde_json::{json, Value}; use serde_json::{json, Value};

View File

@ -1,11 +1,12 @@
mod admin; mod admin;
mod admin_examples;
mod howto; mod howto;
mod service; mod service;
mod state; mod state;
use crate::admin::example;
use crate::service::{handlers, templates}; use crate::service::{handlers, templates};
use crate::state::AppState; use crate::state::AppState;
use admin_examples::static_repository;
use axum::{ use axum::{
extract::State, handler::HandlerWithoutStateExt, response::IntoResponse, routing::get, Router, extract::State, handler::HandlerWithoutStateExt, response::IntoResponse, routing::get, Router,
}; };
@ -34,7 +35,7 @@ async fn main() {
// Prepare App State // Prepare App State
let tmpl = templates::Templates::initialize().expect("Template Engine could not be loaded."); let tmpl = templates::Templates::initialize().expect("Template Engine could not be loaded.");
let mut admin = admin::state::AdminRegistry::new("admin"); let mut admin = admin::state::AdminRegistry::new("admin");
example::register_example(&mut admin); static_repository::register_example(&mut admin);
let state: AppState = AppState { let state: AppState = AppState {
templates: tmpl, templates: tmpl,