mirror of
https://github.com/kjuulh/bitebuds.git
synced 2025-08-12 02:59:46 +02:00
feat: add ci
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use leptos::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -10,11 +12,9 @@ cfg_if! {
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
static ref EVENTSTORE: EventStore = EventStore::default();
|
||||
static ref EVENTSTORE: EventStore = EventStore::new(PathBuf::from("articles"));
|
||||
}
|
||||
async fn get_upcoming_events_fn() -> Result<UpcomingEventsOverview, ServerFnError> {
|
||||
let current_time = chrono::Utc::now();
|
||||
|
||||
let mut events: Vec<EventOverview> = EVENTSTORE
|
||||
.get_upcoming_events()
|
||||
.await
|
||||
@@ -24,7 +24,7 @@ cfg_if! {
|
||||
.map(|data| data.clone().into())
|
||||
.collect();
|
||||
|
||||
events.sort_by(|a, b| a.time.cmp(&b.time));
|
||||
events.sort_by(|a, b| a.time.cmp(&b.time)) ;
|
||||
|
||||
Ok(UpcomingEventsOverview { events })
|
||||
}
|
||||
@@ -33,9 +33,12 @@ cfg_if! {
|
||||
.get_event(event_id)
|
||||
.await
|
||||
.map_err(|e| ServerFnError::ServerError(e.to_string()))?;
|
||||
|
||||
Ok(event)
|
||||
}
|
||||
|
||||
pub async fn boostrap() -> Result<(), ServerFnError> {
|
||||
EVENTSTORE.bootstrap().await.map_err(|e| ServerFnError::ServerError(e.to_string()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
18
src/main.rs
18
src/main.rs
@@ -1,16 +1,24 @@
|
||||
#[cfg(feature = "ssr")]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
use axum::{
|
||||
extract::{Extension, Path},
|
||||
routing::{get, post},
|
||||
Router,
|
||||
};
|
||||
use axum::{extract::Extension, routing::post, Router};
|
||||
use leptos::*;
|
||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
use ssr_modes_axum::app::*;
|
||||
use ssr_modes_axum::fallback::file_and_error_handler;
|
||||
use std::sync::Arc;
|
||||
use tracing::metadata::LevelFilter;
|
||||
|
||||
std::env::set_var(
|
||||
"BITE_ARTICLE_REPO_URL",
|
||||
"git@git.front.kjuulh.io:kjuulh/articles.git",
|
||||
);
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(LevelFilter::TRACE)
|
||||
.init();
|
||||
|
||||
ssr_modes_axum::api::events::boostrap().await.unwrap();
|
||||
|
||||
let conf = get_configuration(None).await.unwrap();
|
||||
let addr = conf.leptos_options.site_addr;
|
||||
|
Reference in New Issue
Block a user