rowt/src/main.rs

37 lines
787 B
Rust
Raw Normal View History

2023-04-13 08:15:55 +02:00
use std::str::FromStr;
2023-07-16 20:07:38 +02:00
#[cfg(feature = "rest")]
use rot::rest;
2023-06-28 14:06:28 +02:00
#[cfg(feature = "rowing-tera")]
use rot::tera;
2023-07-16 20:07:38 +02:00
2023-04-13 08:15:55 +02:00
use sqlx::{pool::PoolOptions, sqlite::SqliteConnectOptions, ConnectOptions};
2023-03-26 14:40:56 +02:00
2023-02-08 16:25:06 +01:00
#[macro_use]
extern crate rocket;
#[launch]
async fn rocket() -> _ {
2023-07-16 18:34:30 +02:00
use sqlx::SqlitePool;
2023-03-04 11:20:12 +01:00
env_logger::init();
2023-03-26 14:40:56 +02:00
let connection_options = SqliteConnectOptions::from_str("sqlite://db.sqlite")
.unwrap()
.log_statements(log::LevelFilter::Debug);
2023-07-16 18:33:17 +02:00
let db: SqlitePool = PoolOptions::new()
2023-04-13 08:15:55 +02:00
.connect_with(connection_options)
.await
.unwrap();
2023-04-03 16:11:26 +02:00
2023-07-16 18:33:17 +02:00
let rocket = rocket::build().manage(db);
#[cfg(feature = "rowing-tera")]
let rocket = tera::config(rocket);
2023-07-16 20:07:38 +02:00
#[cfg(feature = "rest")]
let rocket = rest::config(rocket);
2023-07-16 18:42:59 +02:00
2023-07-16 18:33:17 +02:00
rocket
2023-02-08 16:25:06 +01:00
}