Not able to load images in html
Closed this issue · 6 comments
OscarLahaie commented
dangdennis commented
@aantron I'll take a look this week. Assign to me please
dangdennis commented
let () =
Dream.run
@@ Dream.logger
@@ Dream.router [
Dream.get "/" (Dream.from_filesystem "." "/static/index.html");
Dream.get "/static/**" (Dream.static "./static")
]
Using the f-static
example, I created a static
directory with assets. My /static/index.html
loads my image fine.
29.04.23 23:55:28.500 dream.log INFO REQ 3 GET / ::1:51619 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/112.0
29.04.23 23:55:28.500 dream.log INFO REQ 3 200 in 542 μs
29.04.23 23:55:28.547 dream.log INFO REQ 4 GET /static/test.jpg ::1:51619 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Fire0
29.04.23 23:55:28.547 dream.log INFO REQ 4 200 in 374 μs
The example you're using @OscarLahaie is the w-one-binary
example though.
Possible issues
- your html page is referencing the images incorrectly
- crunch is failing to load properly.
I'll check out the w-one-binary example and see if it works.
dangdennis commented
w-one-binary
works fine too. I built the binary. Copied the binary out to some other area. Ran it, and it served my image.
Can't reproduce.
OscarLahaie commented
aantron commented
Thanks @OscarLahaie and @dangdennis!