31 lines
767 B
Rust
31 lines
767 B
Rust
#![feature(proc_macro_hygiene, decl_macro)]
|
|
|
|
#[macro_use] extern crate rocket;
|
|
#[macro_use] extern crate rocket_contrib;
|
|
|
|
mod game;
|
|
use game::Game;
|
|
|
|
use rocket_contrib::serve::StaticFiles;
|
|
|
|
fn main() {
|
|
let myrocket = rocket::ignite().mount("/", StaticFiles::from("static"));
|
|
let myrocket = myrocket.mount("/api", routes![world,test]);
|
|
myrocket.launch();
|
|
}
|
|
|
|
|
|
#[get("/")]
|
|
fn world() -> &'static str {
|
|
"Hello, world!"
|
|
}
|
|
|
|
#[get("/test")]
|
|
fn test() -> String {
|
|
let mut game: Game = Game::default();
|
|
|
|
game.addPlayer("Daniel".to_string(), Option::Some((255, 0, 0)), Option::Some(game::player::Race::Catte));
|
|
game.addPlayer("Torpus".to_string(), Option::Some((0, 255, 0)), Option::Some(game::player::Race::Griffin));
|
|
|
|
format!("{:#?}", game)
|
|
} |