aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/actix.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/actix.rs b/src/bin/actix.rs
index dd03ece..c2f81fe 100644
--- a/src/bin/actix.rs
+++ b/src/bin/actix.rs
@@ -23,12 +23,13 @@ async fn posts(name: web::Path<String>) -> impl Responder {
#[actix_web::main]
async fn main() -> std::io::Result<()> {
+ let port = env::var("PORT").unwrap_or("3000".into()).parse::<u16>().unwrap_or(3000);
HttpServer::new(|| {
App::new()
.service(index)
.service(posts)
})
- .bind(("0.0.0.0", 3000))?
+ .bind(("0.0.0.0", port))?
.run()
.await
}