be able to use both tera and svelte

This commit is contained in:
philipp 2023-07-16 20:07:38 +02:00
parent 2f6464ff84
commit eb4c4bb558
4 changed files with 9 additions and 7 deletions

View File

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[features]
default = ["rowing-tera", "rest"]
default = ["rest", "rowing-tera" ]
rowing-tera = ["rocket_dyn_templates", "tera"]
rest = []

View File

@ -1,13 +1,15 @@
use std::str::FromStr;
#[cfg(feature = "rest")]
use rot::rest;
#[cfg(feature = "rowing-tera")]
use rot::tera;
use sqlx::{pool::PoolOptions, sqlite::SqliteConnectOptions, ConnectOptions};
#[macro_use]
extern crate rocket;
#[cfg(feature = "rowing-tera")]
#[launch]
async fn rocket() -> _ {
use sqlx::SqlitePool;
@ -26,8 +28,8 @@ async fn rocket() -> _ {
#[cfg(feature = "rowing-tera")]
let rocket = tera::config(rocket);
//#[cfg(feature = "rest")]
//let rocket = rest::config(rocket);
#[cfg(feature = "rest")]
let rocket = rest::config(rocket);
rocket
}

View File

@ -1,7 +1,7 @@
use rocket::{fs::FileServer, Build, Rocket};
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
rocket.mount("/beta", FileServer::from("svelte/build"))
rocket.mount("/", FileServer::from("svelte/build").rank(0))
}
//#[cfg(test)]

View File

@ -13,8 +13,8 @@ const config = {
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter({
fallback: 'app.html',
})
}
}),
},
};
export default config;