feat: refactor frontend routing and authentication

- Changed root div ID from 'root' to 'app' in index.html.
- Updated package.json to include new dependencies for routing and state management.
- Removed App component and replaced it with a router setup in main.tsx.
- Added route definitions for login, about, and index pages.
- Implemented authentication logic using Zustand for state management.
- Created API client with Axios for handling requests and token management.
- Added CORS support in the backend API.
- Updated schema for login requests to use camelCase.
This commit is contained in:
2025-11-16 00:36:30 +01:00
parent f7a839b11a
commit 252491bd2f
19 changed files with 655 additions and 27 deletions

View File

@@ -1,18 +1,19 @@
use std::net::SocketAddr;
use tower_http::cors::CorsLayer;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
pub mod config;
pub mod error;
pub mod extractors;
pub mod factory;
pub mod handlers;
pub mod middleware;
pub mod routes;
pub mod schema;
pub mod security;
pub mod services;
pub mod state;
pub mod extractors;
pub mod schema;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
@@ -33,7 +34,10 @@ async fn main() -> anyhow::Result<()> {
let max_upload_size =
(app_state.config.max_upload_size_mb.unwrap_or(100) * 1024 * 1024) as usize;
let app = routes::api_routes(max_upload_size).with_state(app_state);
let cors = CorsLayer::permissive();
let app = routes::api_routes(max_upload_size)
.layer(cors)
.with_state(app_state);
println!("Starting server at http://{}", addr);

View File

@@ -100,6 +100,7 @@ pub struct RegisterRequest {
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LoginRequest {
pub username_or_email: String,
pub password: String,