pipeline and config
This commit is contained in:
parent
c4d9ca19ce
commit
8dcc6b05db
3 changed files with 43 additions and 9 deletions
|
|
@ -122,17 +122,19 @@ pub async fn start(db_url: &str) -> Result<(), Box<dyn std::error::Error>> {
|
|||
.allow_headers(Any);
|
||||
|
||||
let app = Router::new()
|
||||
.route("/tasks", post(create_task).get(list_tasks))
|
||||
.route("/tasks/:id", get(get_task).put(update_task))
|
||||
.route("/tasks/:id/runs", post(rerun_task))
|
||||
.route("/runs/recent", get(get_recent_runs))
|
||||
.route("/auth/callback", get(auth_callback))
|
||||
.route("/auth/refresh", post(auth_refresh))
|
||||
.route("/api/tasks", post(create_task).get(list_tasks))
|
||||
.route("/api/tasks/:id", get(get_task).put(update_task))
|
||||
.route("/api/tasks/:id/runs", post(rerun_task))
|
||||
.route("/api/runs/recent", get(get_recent_runs))
|
||||
.route("/api/auth/callback", get(auth_callback))
|
||||
.route("/api/auth/refresh", post(auth_refresh))
|
||||
.layer(cors)
|
||||
.with_state(state);
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
||||
println!("Server running on http://localhost:3000");
|
||||
let port = std::env::var("PORT").unwrap_or_else(|_| "3000".to_string());
|
||||
let addr = format!("0.0.0.0:{}", port);
|
||||
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
||||
println!("Server running on http://localhost:{}", port);
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue