fix: base assets path on the manifest dir when running the webserver manually
This commit is contained in:
parent
b807e78ac3
commit
ff2c84fb33
@ -1,9 +1,12 @@
|
|||||||
use ::clego::get_router;
|
use ::clego::get_router;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let router = get_router(Path::new("/assets"));
|
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
let assets_path = Path::new(&manifest_dir).join("assets");
|
||||||
|
let router = get_router(assets_path.as_path());
|
||||||
|
|
||||||
// TODO: select port based on available port (or ask in CLI)
|
// TODO: select port based on available port (or ask in CLI)
|
||||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
|
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user