Compare commits

..

No commits in common. "6d0c2526c94eeb2b34381dc17f3afc12f68bf224" and "9bfe6ded8f58ec65039b80a2304fd99f4d850602" have entirely different histories.

5 changed files with 1 additions and 1357 deletions

View file

@ -1,2 +0,0 @@
[alias]
dev = "run -p backend"

1327
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,2 @@
[workspace]
resolver = "2"
members = ["crates/backend"]

View file

@ -2,7 +2,3 @@
name = "backend"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"
actix-cors = "0.7"

View file

@ -1,23 +1 @@
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
#[cfg(debug_assertions)]
println!("Running debug build -> enabling permissive CORS");
HttpServer::new(move || {
let cors = if cfg!(debug_assertions) {
actix_cors::Cors::permissive()
} else {
actix_cors::Cors::default()
};
App::new().wrap(cors).route("/", web::get().to(index))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
async fn index() -> impl Responder {
HttpResponse::Ok().body("API Test Response")
}
fn main() {}