update actix to use cors stuff
This commit is contained in:
parent
a5ba976abf
commit
1c56bcb107
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -19,6 +19,21 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "actix-cors"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f9e772b3bcafe335042b5db010ab7c09013dad6eac4915c91d8d50902769f331"
|
||||||
|
dependencies = [
|
||||||
|
"actix-utils",
|
||||||
|
"actix-web",
|
||||||
|
"derive_more",
|
||||||
|
"futures-util",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.3.1"
|
version = "3.3.1"
|
||||||
|
@ -2085,6 +2100,7 @@ dependencies = [
|
||||||
name = "tfcapi"
|
name = "tfcapi"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"actix-cors",
|
||||||
"actix-multipart",
|
"actix-multipart",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
|
|
@ -23,3 +23,4 @@ lettre = { version = "0.11.3", features = ["smtp-transport"] }
|
||||||
markup = "0.15.0"
|
markup = "0.15.0"
|
||||||
maud = { version = "0.26.0", features = ["actix-web"] }
|
maud = { version = "0.26.0", features = ["actix-web"] }
|
||||||
log4rs = "1.3.0"
|
log4rs = "1.3.0"
|
||||||
|
actix-cors = "0.7.0"
|
||||||
|
|
18
flake.lock
18
flake.lock
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"cl-nix-lite": {
|
"cl-nix-lite": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709357207,
|
"lastModified": 1720140845,
|
||||||
"narHash": "sha256-YZgXj6oL2Y/zDkSkGcoacpQPRLiYM8KeEB68CUs2irc=",
|
"narHash": "sha256-PHCrp44fIM8RGfXsh413Vo2Cf9CnEqiEuktYv57GkLA=",
|
||||||
"owner": "hraban",
|
"owner": "hraban",
|
||||||
"repo": "cl-nix-lite",
|
"repo": "cl-nix-lite",
|
||||||
"rev": "f55d263b30a601b1b4dd61b7c8787e97510f4018",
|
"rev": "9a9a63a211c7a03eee62fe3dcd3983b8d4ddd5a6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -35,11 +35,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1704194953,
|
"lastModified": 1720031269,
|
||||||
"narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
|
"narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
|
"rev": "9f4128e00b0ae8ec65918efeba59db998750ead6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mod api;
|
mod api;
|
||||||
|
|
||||||
|
use actix_cors::Cors;
|
||||||
use actix_multipart::form::tempfile::TempFileConfig;
|
use actix_multipart::form::tempfile::TempFileConfig;
|
||||||
use actix_web::{middleware, App, HttpServer};
|
use actix_web::{middleware, App, HttpServer};
|
||||||
use api::camp_form::camp_form;
|
use api::camp_form::camp_form;
|
||||||
|
@ -48,8 +49,11 @@ async fn main() -> std::io::Result<()> {
|
||||||
log::info!("starting HTTP server at http://localhost:4242");
|
log::info!("starting HTTP server at http://localhost:4242");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
|
let cors = Cors::permissive();
|
||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
|
.wrap(cors)
|
||||||
.app_data(TempFileConfig::default().directory("./tmp"))
|
.app_data(TempFileConfig::default().directory("./tmp"))
|
||||||
.service(mt_form)
|
.service(mt_form)
|
||||||
.service(health_form)
|
.service(health_form)
|
||||||
|
|
Loading…
Reference in a new issue