V0.2 web api #113
+12
-1
@@ -18,10 +18,21 @@ async fn main() {
|
|||||||
// .route("/users", post(create_user));
|
// .route("/users", post(create_user));
|
||||||
|
|
||||||
// run our app with hyper, listening globally on port 3000
|
// run our app with hyper, listening globally on port 3000
|
||||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
|
let listener = tokio::net::TcpListener::bind(get_full()).await.unwrap();
|
||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_full() -> String {
|
||||||
|
get_address() + ":" + &get_port()
|
||||||
|
}
|
||||||
|
fn get_address() -> String {
|
||||||
|
String::from("0.0.0.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_port() -> String {
|
||||||
|
String::from("3000")
|
||||||
|
}
|
||||||
|
|
||||||
// basic handler that responds with a static string
|
// basic handler that responds with a static string
|
||||||
async fn root() -> &'static str {
|
async fn root() -> &'static str {
|
||||||
"Hello, World!"
|
"Hello, World!"
|
||||||
|
|||||||
Reference in New Issue
Block a user