initial commit

This commit is contained in:
Luuk van Oijen
2023-11-07 22:48:41 +01:00
commit 38aaf29fe8
12 changed files with 2995 additions and 0 deletions

18
src/server/backend.rs Normal file
View File

@@ -0,0 +1,18 @@
use serde::de::DeserializeOwned;
use std::collections::HashMap;
static BACKEND_URL: &'static str = "backend.beammp.com";
static AUTH_URL: &'static str = "auth.beammp.com";
pub async fn authentication_request<R: DeserializeOwned>(
target: &str,
map: HashMap<String, String>,
) -> anyhow::Result<R> {
let client = reqwest::Client::new();
let resp = client
.post(format!("https://{}/{}", AUTH_URL, target))
.json(&map)
.send()
.await?;
Ok(resp.json().await?)
}