add support for files

This commit is contained in:
2021-12-21 00:15:04 +01:00
parent 00fd514da5
commit e4ce767444
18 changed files with 263 additions and 65 deletions

View File

@@ -1,4 +1,5 @@
use actix_web::{middleware, web, App, HttpServer};
use dotenv::dotenv;
#[macro_use]
extern crate lazy_static;
@@ -10,6 +11,7 @@ mod store;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
dotenv().ok();
return HttpServer::new(|| {
App::new()
// .configure(|cfg: &mut web::ServiceConfig| {

View File

@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone)]
pub struct Note {
pub meta: String,
pub contents: String,
pub views: Option<u8>,
pub expiration: Option<u64>,
@@ -14,6 +15,7 @@ pub struct NoteInfo {}
#[derive(Serialize, Deserialize, Clone)]
pub struct NotePublic {
pub meta: String,
pub contents: String,
}

View File

@@ -96,6 +96,7 @@ async fn delete(path: web::Path<NotePath>) -> impl Responder {
}
return HttpResponse::Ok().json(NotePublic {
contents: changed.contents,
meta: changed.meta,
});
}
}