Commit 79431d64 authored by Chunchi Che's avatar Chunchi Che

add todo cards service

parent f35f1919
Pipeline #18037 failed with stages
in 5 minutes and 49 seconds
......@@ -4,13 +4,15 @@ use warp::Filter;
mod infra;
mod service;
const ADDR: &str = "127.0.0.1:3030";
// TODO: Configurable
const DECK_ADDR: &str = "127.0.0.1:3030";
const CARDS_ADDR: &str = "127.0.0.1:3033";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
pretty_env_logger::try_init()?;
// todo: use CORS correctly
// TODO: use CORS correctly
let cors = warp::cors()
.allow_any_origin()
.allow_credentials(true)
......@@ -19,9 +21,18 @@ async fn main() -> anyhow::Result<()> {
let deck = warp::path!("deck" / String)
.map(service::deck_service)
.with(cors);
.with(cors.clone());
warp::serve(deck)
.run(SocketAddr::from_str(DECK_ADDR)?)
.await;
warp::serve(deck).run(SocketAddr::from_str(ADDR)?).await;
// TODO: cards服务暂时仅支持单卡查询
let cards = warp::path!("cards" / String)
.map(service::cards_service)
.with(cors);
warp::serve(cards)
.run(SocketAddr::from_str(CARDS_ADDR)?)
.await;
Ok(())
}
pub fn service(param: String) -> String {
todo!()
}
mod cards;
mod deck;
pub use cards::service as cards_service;
pub use deck::service as deck_service;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment