Some refactoring

This commit is contained in:
2020-10-30 23:20:24 +01:00
parent fe5cd04506
commit 24f3d69301
11 changed files with 241 additions and 182 deletions

View File

@ -1,13 +1,13 @@
#![feature(decl_macro)]
mod database;
mod handlebars_util;
mod routes;
mod status_json;
mod handlebars_util;
use std::{io, env};
use dotenv::dotenv;
use rocket_contrib::templates::Template;
use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template;
use std::{env, io};
fn main() -> io::Result<()> {
dotenv().ok();
@ -17,17 +17,19 @@ fn main() -> io::Result<()> {
let sled = sled::open(db_path)?;
let rocket = rocket::ignite()
.attach(Template::custom(|engines| handlebars_util::register_helpers(engines)))
.attach(Template::custom(|engines| {
handlebars_util::register_helpers(engines)
}))
.manage(sled)
.mount("/static", StaticFiles::from("static"))
.mount(
"/",
rocket::routes![
routes::index,
routes::history,
routes::create_category,
routes::activate_category,
routes::deactivate_category,
routes::pages::index,
routes::pages::history,
routes::api::create_category,
routes::api::activate_category,
routes::api::deactivate_category,
],
);
@ -35,4 +37,3 @@ fn main() -> io::Result<()> {
Ok(())
}