Neo-Poseidon/main.rs

30 lines
590 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();
game.addPlayer("Daniel".to_string());
format!("{:?}", game)
2019-01-23 14:17:04 +01:00
}