This commit is contained in:
Daniel Løvbrøtte Olsen 2019-01-23 14:53:27 +01:00
parent 111f4cc36e
commit c022cf1551
3 changed files with 30 additions and 7 deletions

View File

@ -11,9 +11,9 @@ base64 = "0.10.0"
serde_json = "1.0.36" serde_json = "1.0.36"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]
version = "*" version = "0.4.0"
default-features = false default-features = false
features = ["json"] features = ["json", "serve"]
[[bin]] [[bin]]
name = "Server" name = "Server"

16
main.rs
View File

@ -1,12 +1,18 @@
#![feature(proc_macro_hygiene, decl_macro)] #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate rocket_contrib;
#[get("/")] use rocket_contrib::serve::StaticFiles;
fn index() -> &'static str {
"Hello, world!"
}
fn main() { fn main() {
rocket::ignite().mount("/", routes![index]).launch(); let myrocket = rocket::ignite().mount("/", StaticFiles::from("static"));
let myrocket = myrocket.mount("/api", routes![world]);
myrocket.launch();
}
#[get("/")]
fn world() -> &'static str {
"Hello, world!"
} }

17
static/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Neo Poseidon</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<h1>Welcome to Neo Poseidon</h1>
<p>This is an open source game inspired by Neptune's Pride. An extremely slow paced real time strategy game</p>
<!--<p>There isn't much here, but here are some development links</p>-->
</body>
</html>