diff --git a/src/controller/mod.rs b/src/controller/mod.rs index dbb820f26735760c56d344d212235fbb55ea9780..31e5b4c564cf7f72d67f3d04260e31e887f7379a 100644 --- a/src/controller/mod.rs +++ b/src/controller/mod.rs @@ -6,6 +6,6 @@ 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 1b7e27bbef3b8f484eed7086e1e9712618bf659f..cc8bc69c39be2181cdcd83acc84e7bccb3f6691c 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