mission trip form now posts to nextcloud, skeleton of sqlx
This commit is contained in:
parent
f78e9ea162
commit
87c0d9cb01
5 changed files with 915 additions and 105 deletions
11
src/main.rs
11
src/main.rs
|
@ -5,7 +5,7 @@ use actix_files::Files;
|
|||
use actix_multipart::form::tempfile::TempFileConfig;
|
||||
use actix_web::body::MessageBody;
|
||||
use actix_web::dev::{ServiceRequest, ServiceResponse};
|
||||
use actix_web::{App, Error, HttpServer};
|
||||
use actix_web::{web, App, Error, HttpServer};
|
||||
use api::camp_form::camp_form;
|
||||
use api::church_form::church_form;
|
||||
use api::health_form::health_form;
|
||||
|
@ -15,6 +15,7 @@ use api::parent_form::parent_form;
|
|||
use api::teacher_form::teacher_form;
|
||||
use color_eyre::eyre::Context;
|
||||
use color_eyre::Result;
|
||||
use sqlx::{Connection, SqliteConnection};
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing::{info, Span};
|
||||
use tracing_actix_web::{RootSpanBuilder, TracingLogger};
|
||||
|
@ -76,8 +77,14 @@ async fn main() -> std::io::Result<()> {
|
|||
|
||||
info!("starting HTTP server at http://localhost:4242");
|
||||
|
||||
HttpServer::new(|| {
|
||||
let conn = SqliteConnection::connect("file://./data.db")
|
||||
.await
|
||||
.expect("Couldn't connect sqlite db");
|
||||
let data = web::Data::new(conn);
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(data.clone())
|
||||
.wrap(TracingLogger::<DomainRootSpanBuilder>::new())
|
||||
.app_data(TempFileConfig::default().directory("./tmp"))
|
||||
.service(mt_form)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue