Skip to content

Commit

Permalink
Fix: Fix routing
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Oct 2, 2023
1 parent d86970d commit af8c418
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions sub-image/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ mod models;
mod result;
mod routes;

use axum::{routing::get, Router};
use axum::{
routing::{get, post},
Router,
};
use std::{env, net::SocketAddr};
use tower_http::trace::{self, TraceLayer};
use tracing::{info, Level};

#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(routes::root_get)).layer(
TraceLayer::new_for_http()
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
);
let app = Router::new()
.route("/", get(routes::root_get))
.route("/convert", post(routes::convert_post))
.route("/download/{id}", get(routes::download_get))
.layer(
TraceLayer::new_for_http()
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
);

let port = env::var("PORT").unwrap_or_else(|_| "3203".to_string());

Expand Down

0 comments on commit af8c418

Please sign in to comment.