Skip to content

Commit

Permalink
Create new db on app start.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkbyers committed Mar 16, 2024
1 parent 4047a1f commit 7c98bd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod db;

use std::net::TcpListener;

use actix_web::{dev::Server, web, App, HttpResponse, HttpServer};
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use zero2prod::run;
use zero2prod::{run, db};


#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
db::new_local_db("./.data/mydb").await.expect("Failed to create database");
let listener = std::net::TcpListener::bind("127.0.0.1:8000")
.expect("Failed to bind to port 8000");
run(listener)?.await
Expand Down

0 comments on commit 7c98bd6

Please sign in to comment.