mirror of
https://github.com/Jackzmc/storage.git
synced 2025-05-12 03:53:14 +00:00
Finish moving to hbs
This commit is contained in:
parent
3147da7643
commit
7ff6e3cab4
7 changed files with 113 additions and 16 deletions
|
@ -2,6 +2,8 @@ use std::sync::Arc;
|
|||
use log::debug;
|
||||
use rocket::{catch, launch, routes, Request, State};
|
||||
use rocket::data::ByteUnit;
|
||||
use rocket::fs::{relative, FileServer};
|
||||
use rocket_dyn_templates::handlebars::Handlebars;
|
||||
use rocket_dyn_templates::Template;
|
||||
use sqlx::{migrate, Pool, Postgres};
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
|
@ -32,6 +34,8 @@ async fn rocket() -> _ {
|
|||
setup_logger();
|
||||
dotenvy::dotenv().ok();
|
||||
|
||||
let handlebars = Handlebars::new();
|
||||
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(std::env::var("DATABASE_URL").unwrap().as_str())
|
||||
|
@ -56,8 +60,9 @@ async fn rocket() -> _ {
|
|||
.manage(pool)
|
||||
.manage(repo_manager)
|
||||
.manage(libraries_manager)
|
||||
.mount("/static", FileServer::from(relative!("static")))
|
||||
.mount("/", routes![
|
||||
ui::user::index
|
||||
ui::user::index, ui::user::list_library_files
|
||||
])
|
||||
.mount("/api", routes![
|
||||
api::library::move_file, api::library::upload_file, api::library::download_file, api::library::list_files, api::library::get_file, api::library::delete_file,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue