rocket-pinboard/src/main.rs

35 lines
875 B
Rust
Raw Normal View History

2017-12-06 15:29:10 +01:00
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate comrak;
extern crate glob;
extern crate inflector;
2017-12-06 15:29:10 +01:00
extern crate rocket;
2017-12-06 16:47:55 +01:00
extern crate rocket_contrib;
#[macro_use] extern crate serde_derive;
2018-01-01 18:37:23 +01:00
#[macro_use] extern crate serde_json;
2017-12-06 15:29:10 +01:00
mod handlers;
mod models;
use rocket::Rocket;
use std::sync::RwLock;
type ListStore = RwLock<Vec<models::list::List>>;
fn rocket(lists_path: Option<&str>) -> Rocket {
let lists = models::list::List::load_all(lists_path);
2017-12-06 15:29:10 +01:00
rocket::ignite()
.manage(RwLock::new(lists))
.mount("/", routes![handlers::home::index,
handlers::static_files::all])
.mount("/lists", routes![handlers::list::index,
handlers::list::show_html, handlers::list::show_json,
handlers::list::update])
.attach(rocket_contrib::Template::fairing())
}
fn main() {
rocket(None).launch();
2017-12-06 15:29:10 +01:00
}