Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
chinedufn committed Mar 8, 2019
1 parent b0a1e6a commit 311e49e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/isomorphic/app/src/views/home_view.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::store::Store;
use crate::views::nav_bar_view::ActivePage;
use crate::views::nav_bar_view::NavBarView;
use crate::Msg;

use virtual_dom_rs::prelude::*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::store::Store;
use crate::Msg;
use css_rs_macro::css;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
2 changes: 1 addition & 1 deletion examples/isomorphic/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ edition = "2018"
[dependencies]
virtual-dom-rs = { path = "../../../crates/virtual-dom-rs" }
isomorphic-app = { path = "../app" }
actix-web = "0.7"
actix-web = "0.7.18"
25 changes: 15 additions & 10 deletions examples/isomorphic/server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,25 @@ pub fn serve() {
let app = actix_web::App::new();
let app = app.resource("/", |r| r.f(index));

// Development
#[cfg(debug_assertions)]
let app = app.handler("/", fs::StaticFiles::new("./build").unwrap());

// Production
#[cfg(not(debug_assertions))]
let app = app.handler("/", fs::StaticFiles::new("./dist").unwrap());
let build_dir = {
// Development
#[cfg(debug_assertions)]
{
format!("{}/../client/build", env!("CARGO_MANIFEST_DIR"))
}

#[cfg(not(debug_assertions))]
{
// Production
format!("{}/../client/dist", env!("CARGO_MANIFEST_DIR"))
}
};

let app = app.handler("/", fs::StaticFiles::new(&build_dir).unwrap());

app
});

let path = std::env::current_dir().unwrap();
println!("The current directory is {}", path.display());

let server = server.bind("0.0.0.0:7878").unwrap();

println!("Listening on port 7878");
Expand Down

0 comments on commit 311e49e

Please sign in to comment.