Added database init function

This commit is contained in:
Lukian 2024-12-06 01:00:02 +01:00
parent 6461ebc629
commit 902e96b205
4 changed files with 13 additions and 8 deletions

View file

@ -3,6 +3,9 @@ use actix_files::Files;
use serde_json::json;
use sqlite::{Connection, State, Error};
mod create_db;
use create_db::init;
#[get("/api/hello")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("Hello world!")
@ -45,7 +48,7 @@ async fn api() -> impl Responder {
#[actix_web::main]
async fn main() -> Result<(), std::io::Error> {
let conn = Connection::open("./data/data.db");
init();
HttpServer::new(|| {
App::new()