use axum::{extract::Path, routing::get, Json, Router}; use puppy::{get_local_ap_object, model::schema, Key, Store}; #[tokio::main] async fn main() { let db = Store::open(".state", schema()).unwrap(); let app = Router::new().route( "/o/:ulid", get(|Path(raw_object_id): Path| async move { let object_id = raw_object_id.parse::().unwrap(); let obj = get_local_ap_object(&db, object_id).unwrap().to_json_ld(); Json(obj) }), ); let sock = tokio::net::TcpListener::bind("0.0.0.0:1312").await.unwrap(); axum::serve(sock, app).await.unwrap(); }