/api
This commit is contained in:
		
							parent
							
								
									111f4cc36e
								
							
						
					
					
						commit
						c022cf1551
					
				@ -11,9 +11,9 @@ base64 = "0.10.0"
 | 
			
		||||
serde_json = "1.0.36"
 | 
			
		||||
 | 
			
		||||
[dependencies.rocket_contrib]
 | 
			
		||||
version = "*"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
default-features = false
 | 
			
		||||
features = ["json"]
 | 
			
		||||
features = ["json", "serve"]
 | 
			
		||||
 | 
			
		||||
[[bin]]
 | 
			
		||||
name = "Server"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								main.rs
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								main.rs
									
									
									
									
									
								
							@ -1,12 +1,18 @@
 | 
			
		||||
#![feature(proc_macro_hygiene, decl_macro)]
 | 
			
		||||
 | 
			
		||||
#[macro_use] extern crate rocket;
 | 
			
		||||
#[macro_use] extern crate rocket_contrib;
 | 
			
		||||
 | 
			
		||||
#[get("/")]
 | 
			
		||||
fn index() -> &'static str {
 | 
			
		||||
    "Hello, world!"
 | 
			
		||||
}
 | 
			
		||||
use rocket_contrib::serve::StaticFiles;
 | 
			
		||||
 | 
			
		||||
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
									
								
							
							
						
						
									
										17
									
								
								static/index.html
									
									
									
									
									
										Normal 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>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user