mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
This commit is contained in:
14
rc_microtransactions/src/main.rs
Normal file
14
rc_microtransactions/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
mod robocraft;
|
||||
|
||||
#[rocket::get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
fn rocket() -> _ {
|
||||
env_logger::init();
|
||||
rocket::build().mount("/", rocket::routes![index])
|
||||
.attach(robocraft::stage())
|
||||
}
|
||||
|
||||
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
7
rc_microtransactions/src/robocraft/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod store;
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("JSON", |rocket| async {
|
||||
rocket.attach(store::stage())
|
||||
})
|
||||
}
|
||||
17
rc_microtransactions/src/robocraft/store.rs
Normal file
17
rc_microtransactions/src/robocraft/store.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use rocket::{post, routes, serde::json::{json, Value}};
|
||||
|
||||
#[post("/robopay/store")]
|
||||
pub fn robopay_store() -> Value {
|
||||
// TODO authentication (Authorization header is "Robocraft {JWT token from auth}")
|
||||
json!({
|
||||
"response": {
|
||||
"data": []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stage() -> rocket::fairing::AdHoc {
|
||||
rocket::fairing::AdHoc::on_ignite("Robocraft store info", |rocket| async {
|
||||
rocket.mount("/", routes![robopay_store])
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user