26 lines
479 B
Rust
26 lines
479 B
Rust
use std::env;
|
|
|
|
use actix_web::{App, HttpServer, web};
|
|
use sqlx::sqlite::SqlitePool;
|
|
use dotenv::dotenv;
|
|
|
|
mod auth;
|
|
mod models;
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
dotenv()?;
|
|
let pool = SqlitePool::connect(&env::var("DATABASE_URL")?).await?;
|
|
|
|
HttpServer::new(move || {
|
|
App::new()
|
|
.app_data(web::Data::new(pool.clone()))
|
|
.configure(auth::init)
|
|
})
|
|
.bind(("127.0.0.1", 8080))?
|
|
.run()
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|