update actix to version 4

This commit is contained in:
2022-03-01 00:53:47 +01:00
parent 1adf87b884
commit 229c8d8368
7 changed files with 337 additions and 918 deletions

25
backend/src/api.rs Normal file
View File

@@ -0,0 +1,25 @@
use actix_web::{get, web, HttpResponse, Responder};
use serde::{Deserialize, Serialize};
use crate::note;
use crate::size::LIMIT;
#[derive(Serialize, Deserialize)]
struct Status {
version: String,
max_size: usize,
}
#[get("/status")]
async fn status() -> impl Responder {
return HttpResponse::Ok().json(Status {
version: option_env!("CARGO_PKG_VERSION")
.unwrap_or("Unknown")
.to_string(),
max_size: *LIMIT,
});
}
pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(web::scope("/api").service(note::service()).service(status));
}