Browse Source

can run server from server folder

Inderjit Gill 6 months ago
parent
commit
b7cd178602
2 changed files with 12 additions and 9 deletions
  1. 5
    2
      README.md
  2. 7
    7
      server/src/main.rs

+ 5
- 2
README.md View File

@@ -16,8 +16,11 @@ It's scripts can be annotated so that genetic algorithms can generate variations
16 16
 
17 17
 1. `cd server`
18 18
 2. `cargo build --release`'
19
-3. `cd ..`
20
-4. `cp server/target/release/seni-server .`
19
+
20
+#### Running the server:
21
+
22
+1. `cd server`
23
+2. `cargo run --release`
21 24
 
22 25
 #### Building wasm file:
23 26
 

+ 7
- 7
server/src/main.rs View File

@@ -18,7 +18,7 @@ struct Piece {
18 18
 // }
19 19
 
20 20
 fn favicon_c(_req: &HttpRequest) -> Result<fs::NamedFile> {
21
-    Ok(fs::NamedFile::open("client/www/assets/favicon.ico")?)
21
+    Ok(fs::NamedFile::open("../client/www/assets/favicon.ico")?)
22 22
 }
23 23
 
24 24
 fn gallery(req: &HttpRequest) -> Result<HttpResponse> {
@@ -45,7 +45,7 @@ fn gallery_item(req: &HttpRequest) -> Result<fs::NamedFile> {
45 45
     let param_id = req.match_info().get("id").unwrap();
46 46
     let id: u32 = std::str::FromStr::from_str(param_id).unwrap();
47 47
     let name = get_piece_name_from_id(&g, id).unwrap();
48
-    let path = ["server/static/seni", &name].join("/");
48
+    let path = ["../server/static/seni", &name].join("/");
49 49
     let path_with_ext = [path, "seni".to_string()].join(".");
50 50
 
51 51
     Ok(fs::NamedFile::open(path_with_ext)?)
@@ -84,15 +84,15 @@ fn main() {
84 84
     let sys = actix::System::new("seni-server");
85 85
 
86 86
     if using_c {
87
-        println!("using the older C_IMPL");
87
+        println!("serving c client");
88 88
     } else {
89
-        println!("hello from the RUST_IMPL");
89
+        println!("serving rust client");
90 90
     }
91 91
 
92 92
     let home = if using_c {
93
-        "client/www/assets"
93
+        "../client/www/assets"
94 94
     } else {
95
-        "client/sen-client/www"
95
+        "../client/sen-client/www"
96 96
     };
97 97
 
98 98
     server::new(move || {
@@ -113,7 +113,7 @@ fn main() {
113 113
                 })
114 114
             })
115 115
             // static files
116
-            .handler("/dist", fs::StaticFiles::new("client/www/dist").unwrap())
116
+            .handler("/dist", fs::StaticFiles::new("../client/www/dist").unwrap())
117 117
             .handler("/", fs::StaticFiles::new(home).unwrap())
118 118
     })
119 119
     .bind(bind_addr)

Loading…
Cancel
Save