forked from alemi/upub
feat: cors and tracing layers
This commit is contained in:
parent
85375ba1fb
commit
6613f337ce
2 changed files with 4 additions and 0 deletions
|
@ -40,6 +40,7 @@ sea-orm-migration = { version = "0.12", optional = true }
|
|||
# mastodon
|
||||
mastodon-async-entities = { version = "1.1.0", optional = true }
|
||||
time = { version = "0.3", features = ["serde"], optional = true }
|
||||
tower-http = { version = "0.5.2", features = ["cors", "trace"] }
|
||||
|
||||
[features]
|
||||
default = ["faker", "migrations", "mastodon"]
|
||||
|
|
|
@ -14,6 +14,7 @@ use clap::{Parser, Subcommand};
|
|||
use sea_orm::{ConnectOptions, Database, EntityTrait, IntoActiveModel};
|
||||
|
||||
pub use errors::UpubResult as Result;
|
||||
use tower_http::{cors::CorsLayer, trace::TraceLayer};
|
||||
|
||||
use crate::server::fetcher::Fetchable;
|
||||
|
||||
|
@ -107,6 +108,8 @@ async fn main() {
|
|||
let router = axum::Router::new()
|
||||
.ap_routes()
|
||||
.mastodon_routes() // no-op if mastodon feature is disabled
|
||||
.layer(CorsLayer::permissive())
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.with_state(ctx);
|
||||
|
||||
// run our app with hyper, listening locally on port 3000
|
||||
|
|
Loading…
Reference in a new issue