[SOLVED] Warp serves HTML but JS file not loaded

#1

I have the following setup:

main.rs **server run from here**
      +-sub1
      +-sub2
      +-sub3
           +-myHTML.html
           +-myJS.js

The myHTML.html contains the following:

<head>
...
<script src="myJS.js"></script>
</head>

The path in main.rs is defined as:

warp::path("myHTML").and(warp::fs::file("./sub3/myHTML.html"))

When I run the warp server in main.rs it serves the myHTML.html file but myJS.js is not loaded. When I just load the html file in the browser directly it loads the js file just fine, so the path seems correct. What do I need to do to have warp load the js file?


I’m dumb. Just need to add another route for the JS file warp::fs::file("./sub3/myJS.js")).

0 Likes