Skip to content

Commit

Permalink
Fixing the back-end
Browse files Browse the repository at this point in the history
  • Loading branch information
elielnfinic committed Dec 9, 2022
1 parent ddff595 commit 359860e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
use actix_web::{web, App, HttpServer};
use actix_web::{get, web, App, HttpServer,HttpResponse,Responder};
use dotenv;
use actix_cors::Cors;

mod contact;

#[get("/")]
async fn index() -> impl Responder {
HttpResponse::Ok()
.header("Content-Type", "text/html")
.body("Everything works!")
}

#[actix_web::main]
async fn main() -> std::io::Result<()>{
let server_addr = dotenv::var("SERVER_ADDR").expect("SERVER ADDRESS number must be set in .env");

println!("Server is running on {}", server_addr);

HttpServer::new(|| {

App::new()
.wrap(Cors::permissive())
.service(contact::add)
.service(index)
})
.bind(server_addr)?
.run()
Expand Down

0 comments on commit 359860e

Please sign in to comment.