Skip to content

Commit

Permalink
Tell server to serve static files
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshaughnessy committed Nov 7, 2023
1 parent 42a3ecc commit 1a5855a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ default-run = "server"

[dependencies]
actix-cors = "0.6.4"
actix-files = "0.6.2"
actix-rt = "2.9.0"
actix-web = "4.4.0"
chrono = { version = "0.4.31", features = ["serde"] }
Expand Down
2 changes: 2 additions & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern crate diesel;

use actix_cors::Cors;
use actix_files as fs;
use actix_web::{http, web, App, HttpServer};
use diesel::r2d2::{self, ConnectionManager};
use diesel::PgConnection;
Expand Down Expand Up @@ -47,6 +48,7 @@ async fn main() -> std::io::Result<()> {
App::new()
.wrap(cors)
.app_data(web::Data::new(pool.clone()))
.service(fs::Files::new("/", "/track/server/static/client/").index_file("index.html"))
.service(
web::scope("/api")
.service(
Expand Down

0 comments on commit 1a5855a

Please sign in to comment.