db pool and address

This commit is contained in:
LinlyBoi
2023-12-17 22:12:59 +02:00
parent 3fbb68d349
commit 33074b4c6b

View File

@@ -1,6 +1,6 @@
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder};
use dotenv::dotenv;
use witl_api::*;
#[post("/echo")]
async fn echo(req_body: String) -> impl Responder {
HttpResponse::Ok().body(req_body)
@@ -13,11 +13,12 @@ async fn manual_hello() -> impl Responder {
#[actix_web::main]
async fn main() -> std::io::Result<()> {
dotenv().ok();
let (port, address) = init_address();
HttpServer::new(|| {
App::new()
.service(hello)
.service(echo)
.route("/hey", web::get().to(manual_hello))
.app_data(web::Data::new(init_dbpool()))
})
.bind(("localhost", 8080))?
.run()