aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index fdc8ff3..2b4d01b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,11 +16,36 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+#[macro_use] extern crate rocket;
+
use ramaskrik;
-use std::error::Error;
-use std::result::Result;
+use ramaskrik::controllers::{event, film, room, screening};
+use ramaskrik::db;
+
+use rocket::routes;
+use rocket::fs::FileServer;
+use rocket_dyn_templates::Template;
-fn main() -> Result<(), Box<dyn Error>> {
- ramaskrik::build_rocket()?.launch();
- Ok(())
+#[launch]
+fn rocket() -> _ {
+ rocket::build()
+ .attach(db::Connection::fairing())
+ .attach(Template::fairing())
+ .mount("/", routes![
+ event::index,
+ event::new,
+ event::create,
+ ])
+ .mount("/", FileServer::from("public/"))
+ .mount("/rooms", routes![room::get_rooms_json, room::list_rooms, room::new_room, room::create_room])
+ .mount("/films", routes![film::get_films_json, film::list_films, film::new_film, film::create_film])
+ .mount("/screenings", routes![
+ screening::get_aggregated_screenings,
+ screening::list_screenings,
+ screening::new_screening,
+ screening::create_screening,
+ screening::edit,
+ screening::update,
+ screening::delete,
+ ])
}