27 lines
617 B
Rust
27 lines
617 B
Rust
use axum::{
|
|
Json,
|
|
routing::get,
|
|
extract::Path,
|
|
http::StatusCode,
|
|
Router,
|
|
};
|
|
use serde_json::{Value, json};
|
|
use tokio::net::TcpListener;
|
|
|
|
pub async fn setup() {
|
|
let app = Router::new()
|
|
.route("/xrpc/{*nsid}", get(not_implemented).post(not_implemented));
|
|
|
|
let listener = TcpListener::bind("0.0.0.0:6702").await.unwrap();
|
|
axum::serve(listener, app).await.unwrap();
|
|
}
|
|
|
|
async fn not_implemented(Path(_nsid): Path<String>) -> (StatusCode, Json<Value>) {
|
|
(
|
|
StatusCode::NOT_IMPLEMENTED,
|
|
Json(json!({
|
|
"error": "MethodNotImplemented",
|
|
"message": "Method Not Implemented"
|
|
}))
|
|
)
|
|
}
|