Created Axum routing for localhost, also SQL Table structure
Added a axum router and listener for serving a web page on localhost. Also a sql table structure was created with sqlx migrate for storing tickets and users
This commit is contained in:
2230
backend/Cargo.lock
generated
Normal file
2230
backend/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,4 +7,5 @@ edition = "2024"
|
||||
axum = "0.8.9"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio", "tls-native-tls"] }
|
||||
tokio = { version = "1.52.1", features = ["tr-multi-thread", "macros"] }
|
||||
tokio = { version = "1.52.1", features = ["rt-multi-thread", "macros"] }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use axum::{Router, routing};
|
||||
use dotenv::dotenv;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{PgPool, postgres::PgPoolOptions};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let app = Router::new().route("/", routing::get(root_handler));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:8001").await.unwrap();
|
||||
axum::serve(listener, app).await;
|
||||
}
|
||||
|
||||
async fn root_handler() -> &'static str {
|
||||
"Hello, World"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user