Seperate into multiple files. Add configuration options

This commit is contained in:
Nick Bland
2021-11-07 00:08:33 +10:00
parent 88d2cfdd8e
commit 782796486e
11 changed files with 711 additions and 40 deletions

View File

@@ -1,11 +1,12 @@
use std::net::TcpListener;
use mail_app::startup::run;
// Create new instance of the application on a random port and return address [`http://localhost:XXXX`]
fn spawn_app() -> String {
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind to random port");
let port = listener.local_addr().unwrap().port();
let server = mail_app::run(listener).expect("Failed to bind address");
let server = run(listener).expect("Failed to bind address");
let _ = tokio::spawn(server);