fedimovies/src/mastodon_api/instance/views.rs

19 lines
453 B
Rust
Raw Normal View History

2021-11-07 08:52:57 +00:00
use actix_web::{get, web, HttpResponse, Scope};
2021-04-09 00:22:17 +00:00
use crate::config::Config;
use crate::errors::HttpError;
use super::types::InstanceInfo;
2021-04-09 00:22:17 +00:00
2021-11-07 08:52:57 +00:00
#[get("")]
async fn instance_view(
config: web::Data<Config>,
2021-04-09 00:22:17 +00:00
) -> Result<HttpResponse, HttpError> {
let instance = InstanceInfo::from(config.as_ref());
2021-04-09 00:22:17 +00:00
Ok(HttpResponse::Ok().json(instance))
}
2021-11-07 08:52:57 +00:00
pub fn instance_api_scope() -> Scope {
web::scope("/api/v1/instance")
.service(instance_view)
}