Added some test code :s:
This commit is contained in:
parent
f5c3065c5a
commit
c385836aa0
17
src/main.rs
17
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])
|
||||
}
|
8
src/types/mod.rs
Normal file
8
src/types/mod.rs
Normal 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,
|
||||
}
|
Loading…
Reference in New Issue
Block a user