65 lines
1.9 KiB
Rust
65 lines
1.9 KiB
Rust
#![recursion_limit = "256"]
|
|
#![feature(proc_macro_hygiene, decl_macro)]
|
|
|
|
#[macro_use]
|
|
extern crate diesel;
|
|
|
|
use rocket::{catchers, routes, Rocket};
|
|
use rocket_contrib::serve::StaticFiles;
|
|
|
|
pub mod catchers;
|
|
pub mod handlers;
|
|
|
|
fn rocket() -> Rocket {
|
|
let static_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/static");
|
|
let static_files = StaticFiles::from(static_dir);
|
|
|
|
rocket::ignite()
|
|
.mount("/", routes![handlers::index])
|
|
.mount(
|
|
"/company",
|
|
routes![handlers::company::index, handlers::company::create],
|
|
)
|
|
.mount(
|
|
"/customers",
|
|
routes![
|
|
handlers::customers::index,
|
|
handlers::customers::create,
|
|
handlers::customers::new,
|
|
handlers::customers::show,
|
|
handlers::customers::update,
|
|
handlers::customers::destroy,
|
|
handlers::customers::invoices::create,
|
|
handlers::customers::invoices::new,
|
|
handlers::customers::invoices::show,
|
|
handlers::customers::invoices::update,
|
|
handlers::customers::tasks::create,
|
|
handlers::customers::tasks::new,
|
|
handlers::customers::tasks::show,
|
|
handlers::customers::tasks::update,
|
|
handlers::customers::tasks::destroy,
|
|
],
|
|
)
|
|
.mount("/invoices", routes![handlers::invoices::index])
|
|
.mount("/static", static_files)
|
|
.mount(
|
|
"/timeline",
|
|
routes![
|
|
handlers::timeline::index,
|
|
handlers::timeline::create,
|
|
handlers::timeline::new,
|
|
handlers::timeline::show,
|
|
handlers::timeline::update,
|
|
handlers::timeline::destroy,
|
|
],
|
|
)
|
|
.register(catchers![
|
|
catchers::not_found,
|
|
catchers::unprocessable_entity
|
|
])
|
|
}
|
|
|
|
fn main() {
|
|
rocket().launch();
|
|
}
|