diff --git a/src/controller/mod.rs b/src/controller/mod.rs index 46b082483d1bf1e31eee945567a29d18a3bfdd70..c16373f096ca82cb1bf3b149cea26c3af084357c 100644 --- a/src/controller/mod.rs +++ b/src/controller/mod.rs @@ -7,6 +7,7 @@ pub mod notification; pub fn route_stage() -> AdHoc { return AdHoc::on_ignite("Initializing controller routes...", |rocket| async { rocket - .mount("/", routes![notification::subscribe, notification::unsubscribe, notification::receive]) + .mount("/", routes![notification::subscribe, notification::unsubscribe, + notification::receive, notification::list]) }); } diff --git a/src/controller/notification.rs b/src/controller/notification.rs index 1b7e27bbef3b8f484eed7086e1e9712618bf659f..370c808d735632d6baa229da2e37a14b67d50053 100644 --- a/src/controller/notification.rs +++ b/src/controller/notification.rs @@ -27,4 +27,12 @@ pub fn receive(notification: Json<Notification>) -> Result<Json<Notification>> { Ok(f) => Ok(Json::from(f)), Err(e) => Err(e) }; +} + +#[get("/")] +pub fn list() -> Result<Json<Vec<String>>> { + return match NotificationService::list_messages() { + Ok(f) => Ok(Json::from(f)), + Err(e) => Err(e) + }; } \ No newline at end of file