Neo-Poseidon/main.rs

31 lines
767 B
Rust
Raw Normal View History

2019-01-23 14:17:04 +01:00
#![feature(proc_macro_hygiene, decl_macro)]
2019-01-23 14:17:04 +01:00
#[macro_use] extern crate rocket;
2019-01-23 14:53:27 +01:00
#[macro_use] extern crate rocket_contrib;
2019-05-08 01:36:04 +02:00
mod game;
2019-05-09 00:13:15 +02:00
use game::Game;
2019-05-08 01:36:04 +02:00
2019-01-23 14:53:27 +01:00
use rocket_contrib::serve::StaticFiles;
2019-01-23 14:17:04 +01:00
fn main() {
2019-01-23 14:53:27 +01:00
let myrocket = rocket::ignite().mount("/", StaticFiles::from("static"));
2019-05-09 00:13:15 +02:00
let myrocket = myrocket.mount("/api", routes![world,test]);
2019-01-23 14:53:27 +01:00
myrocket.launch();
}
#[get("/")]
fn world() -> &'static str {
"Hello, world!"
2019-05-09 00:13:15 +02:00
}
#[get("/test")]
fn test() -> String {
let mut game: Game = Game::default();
2019-05-09 01:16:43 +02:00
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)
2019-01-23 14:17:04 +01:00
}