diff --git a/src/controller/mod.rs b/src/controller/mod.rs index 25cc704e24f34dc37b782b17302a90e0e69c4872..d6e6fdfcb7ae49b65cbc2bd543ef8bb7cd60e829 100644 --- a/src/controller/mod.rs +++ b/src/controller/mod.rs @@ -4,7 +4,7 @@ pub fn route_stage() -> AdHoc { return AdHoc::on_ignite("Initializing controller routes...", |rocket| async { rocket .mount("/", routes![notification::subscribe, notification::unsubscribe, - notification::receive]) + notification::receive, notification::list]) }); } diff --git a/src/controller/notification.rs b/src/controller/notification.rs index 5a5cf588b97d315797c4ccffdf1db95f1f3358fe..4b2e4e7db34908340c08b482868d37cff46a21e9 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