pub mod model; use self::model::Role; use rocket::{self, http::Status}; use rocket_contrib::json::{Json, JsonValue}; use crate::db; #[get("/all")] pub fn get_all(connection: db::DbConn) -> Json { // Return all roles as an array of objects Json(json!({ "roles": Role::get_all(&connection) })) } pub fn mount(rocket: rocket::Rocket) -> rocket::Rocket { rocket.mount("/api/roles", routes![get_all]) }