Files
storkit/server/src/main.rs

44 lines
1.3 KiB
Rust
Raw Normal View History

2026-02-16 16:24:21 +00:00
mod http;
mod io;
mod llm;
mod state;
mod store;
mod workflow;
2026-02-16 16:24:21 +00:00
use crate::http::build_routes;
use crate::http::context::AppContext;
use crate::state::SessionState;
use crate::store::JsonFileStore;
use crate::workflow::WorkflowState;
2026-02-16 16:24:21 +00:00
use poem::Server;
use poem::listener::TcpListener;
use std::path::PathBuf;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
let app_state = Arc::new(SessionState::default());
let store = Arc::new(
JsonFileStore::from_path(PathBuf::from("store.json")).map_err(std::io::Error::other)?,
);
let workflow = Arc::new(std::sync::Mutex::new(WorkflowState::default()));
let ctx = AppContext {
state: app_state,
store,
workflow,
};
2026-02-16 16:24:21 +00:00
let app = build_routes(ctx);
2026-02-16 17:10:23 +00:00
println!(
"\x1b[95;1m ____ _ _ ___ _ \n / ___|| |_ ___ _ __| | _|_ _| |_ \n \\___ \\| __/ _ \\| '__| |/ /| || __|\n ___) | || (_) | | | < | || |_ \n |____/ \\__\\___/|_| |_|\\_\\___|\\__|\n\x1b[0m"
);
println!("\x1b[96;1mFrontend:\x1b[0m \x1b[94mhttp://127.0.0.1:3001\x1b[0m");
println!("\x1b[92;1mOpenAPI Docs:\x1b[0m \x1b[94mhttp://127.0.0.1:3001/docs\x1b[0m");
Server::new(TcpListener::bind("127.0.0.1:3001"))
.run(app)
.await
}