Started working on a cli frontend.
This commit is contained in:
@@ -3,6 +3,7 @@ pub mod schema;
|
||||
pub mod util;
|
||||
|
||||
use actix_cors::Cors;
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::HttpServer;
|
||||
use actix_web::App;
|
||||
use actix_web::http;
|
||||
@@ -12,6 +13,7 @@ use diesel::r2d2::{ConnectionManager, Pool};
|
||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||
use request::{login, register, gamenights, gamenight_post, gamenight_get};
|
||||
use util::GetConnection;
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
||||
pub(crate) type DbPool = Pool<ConnectionManager<PgConnection>>;
|
||||
|
||||
@@ -35,6 +37,8 @@ async fn main() -> std::io::Result<()> {
|
||||
let mut conn = pool.get_conn();
|
||||
run_migration(&mut conn);
|
||||
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
HttpServer::new(move || {
|
||||
let cors = Cors::default()
|
||||
.allowed_origin("0.0.0.0")
|
||||
@@ -46,6 +50,8 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
App::new()
|
||||
.wrap(cors)
|
||||
.wrap(Logger::default())
|
||||
.wrap(TracingLogger::default())
|
||||
.app_data(web::Data::new(pool.clone()))
|
||||
.service(login)
|
||||
.service(register)
|
||||
|
||||
Reference in New Issue
Block a user