Started working on user authentication

This commit is contained in:
2025-03-10 22:41:33 +01:00
parent 6fdf0cb7eb
commit 3558e7d3d0
6 changed files with 159 additions and 4 deletions

View File

@@ -1,3 +1,24 @@
fn main() {
println!("Hello, world!");
mod users;
use std::sync::Mutex;
use users::*;
use actix_web::{App, HttpServer};
use actix_web::web::Data;
use sqlx::sqlite::SqlitePool;
#[derive(Clone)]
struct AppState {
database: SqlitePool,
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let pool = SqlitePool::connect("sqlite:database.db").await.expect("Could not connect to db");
let app_state = Data::new(AppState { database: pool });
HttpServer::new(move || {
App::new()
.service(login)
.app_data(app_state.clone())
}).bind(("127.0.0.1", 8000))?.run().await
}