From c385836aa009ac836960dbdb81b464c998bd7e4f Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sat, 5 Nov 2022 20:01:53 +0100 Subject: [PATCH] Added some test code :s: --- src/main.rs | 17 ++++++++++++++++- src/types/mod.rs | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/types/mod.rs diff --git a/src/main.rs b/src/main.rs index f090233..da5b5c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,26 @@ #[macro_use] extern crate rocket; +mod types; + #[get("/")] fn index() -> &'static str { "Hello, world!" } +#[get("/map")] +fn map() -> String { + let map = types::Map { + name: "Test".into(), + server: "USA".into(), + points: 5, + stars: 3, + mapper: "Furo".into() + }; + + format!("Map {} by {}", map.name, map.mapper) +} + #[launch] fn rocket() -> _ { - rocket::build().mount("/", routes![index]) + rocket::build().mount("/", routes![index, map]) } \ No newline at end of file diff --git a/src/types/mod.rs b/src/types/mod.rs new file mode 100644 index 0000000..a0d3f2a --- /dev/null +++ b/src/types/mod.rs @@ -0,0 +1,8 @@ +#[derive(Debug)] +pub struct Map { + pub name: String, + pub server: String, + pub points: i8, + pub stars: i8, + pub mapper: String, +} \ No newline at end of file