setting up more for idk, rust servers i guess
This commit is contained in:
parent
09f3ea62f2
commit
d8740cdb73
25
Cargo.lock
generated
25
Cargo.lock
generated
|
@ -914,6 +914,24 @@ dependencies = [
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "multer"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"encoding_rs",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"httparse",
|
||||||
|
"log",
|
||||||
|
"memchr",
|
||||||
|
"mime",
|
||||||
|
"spin",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "native-tls"
|
name = "native-tls"
|
||||||
version = "0.2.11"
|
version = "0.2.11"
|
||||||
|
@ -1319,6 +1337,12 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "spin"
|
||||||
|
version = "0.9.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
|
@ -1371,6 +1395,7 @@ dependencies = [
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"multer",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
multer = "2.1.0"
|
||||||
actix = "0.13.0"
|
actix = "0.13.0"
|
||||||
actix-rt = "2.8.0"
|
actix-rt = "2.8.0"
|
||||||
actix-web = "4.3.1"
|
actix-web = "4.3.1"
|
||||||
|
|
|
@ -67,9 +67,9 @@
|
||||||
/* console.log(JSON.stringify(data)); */
|
/* console.log(JSON.stringify(data)); */
|
||||||
fetch("http://localhost:4242/health-form", {
|
fetch("http://localhost:4242/health-form", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
/* headers: {
|
||||||
"Content-Type": "multipart/form-data",
|
* "Content-Type": "multipart/form-data",
|
||||||
},
|
* }, */
|
||||||
body: data
|
body: data
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{env, io};
|
use std::{env, io};
|
||||||
use actix_web::{middleware, web, App, HttpServer, get, post, Responder, http::header::ContentType, HttpResponse, HttpRequest, http::{StatusCode, Method}};
|
use actix_web::{middleware, web, App, HttpServer, get, post, Responder, http::header::ContentType, HttpResponse, HttpRequest, http::{StatusCode, Method}, HttpMessage};
|
||||||
|
use multer::Multipart;
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
|
@ -21,5 +22,9 @@ async fn main() -> io::Result<()> {
|
||||||
#[post("/health-form")]
|
#[post("/health-form")]
|
||||||
async fn form(req: HttpRequest) -> HttpResponse {
|
async fn form(req: HttpRequest) -> HttpResponse {
|
||||||
println!("{req:?}");
|
println!("{req:?}");
|
||||||
|
println!("{:?}", req.content_type());
|
||||||
|
println!("{:?}", req);
|
||||||
|
println!("{:?}", req.headers().get("content-type"));
|
||||||
|
// let multipart = Multipart::new(stream, boundary);
|
||||||
HttpResponse::Ok().respond_to(&req)
|
HttpResponse::Ok().respond_to(&req)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue