feat: frontend routes (just the index html file for now)
This commit is contained in:
11
src/server/frontend.rs
Normal file
11
src/server/frontend.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use axum::response::Html;
|
||||
use axum_extra::routing::TypedPath;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, TypedPath)]
|
||||
#[typed_path("/")]
|
||||
pub struct IndexPath;
|
||||
|
||||
pub async fn spa(_: IndexPath) -> Html<&'static str> {
|
||||
Html(include_str!("index.html"))
|
||||
}
|
||||
@@ -6,11 +6,13 @@ use rand::Rng;
|
||||
use rand::RngExt;
|
||||
use secrecy::SecretString;
|
||||
use std::sync::Arc;
|
||||
use tower_http::cors::CorsLayer;
|
||||
use typed_builder::TypedBuilder;
|
||||
use url::Url;
|
||||
|
||||
mod chat;
|
||||
mod decisions;
|
||||
mod frontend;
|
||||
mod embeddings;
|
||||
mod models;
|
||||
mod system_one;
|
||||
@@ -46,6 +48,8 @@ pub fn create_router() -> Router<AppState> {
|
||||
.typed_post(embeddings::create_embeddings)
|
||||
.typed_post(system_one::create_system_one)
|
||||
.typed_get(models::list_models)
|
||||
.typed_get(frontend::spa)
|
||||
.layer(CorsLayer::new())
|
||||
}
|
||||
|
||||
pub fn create_app(state: AppState) -> Router<()> {
|
||||
|
||||
Reference in New Issue
Block a user