Started working on user authentication
This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user