Added some test code :s:

main
BurnyLlama 2022-11-05 20:01:53 +01:00
parent f5c3065c5a
commit c385836aa0
2 changed files with 24 additions and 1 deletions

View File

@ -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])
}

8
src/types/mod.rs Normal file
View File

@ -0,0 +1,8 @@
#[derive(Debug)]
pub struct Map {
pub name: String,
pub server: String,
pub points: i8,
pub stars: i8,
pub mapper: String,
}