30 lines
590 B
Rust
30 lines
590 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());
|
|
|
|
format!("{:?}", game)
|
|
} |