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" edition = "2021"
[features] [features]
default = ["rowing-tera", "rest"] default = ["rest", "rowing-tera" ]
rowing-tera = ["rocket_dyn_templates", "tera"] rowing-tera = ["rocket_dyn_templates", "tera"]
rest = [] rest = []

View File

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

View File

@ -1,7 +1,7 @@
use rocket::{fs::FileServer, Build, Rocket}; use rocket::{fs::FileServer, Build, Rocket};
pub fn config(rocket: Rocket<Build>) -> Rocket<Build> { 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)] //#[cfg(test)]

View File

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