简体   繁体   中英

default path issue with static files with Suave, in F#

I am not understanding the doc when it comes to serving static files.

I have a site where the backend is deployed to /app in a docker container and the front end part is deployed to /app/frontend

The main file for the front end is at: /app/frontend/index.html

In the config I have this:

homeFolder = Some "/app/frontend"

and then:

GET >=> choose
    [
        path "/healthcheck" >=> Successful.OK "ok"
        pathScan "/checkqr/%s" checkQRCode
        path "/" >=> Files.file "index.html"
        Files.browseHome
    ]

when I go to domain.com I get a 404 but when I go to domain.com/index.html I get the index.

what did I miss with the syntax? I would like to serve the index.html file when going to domain.com


Tests done in the meantime:

path "/" >=> Files.browse "index.html"
path "/" >=> Files.file "index.html"
path "/" >=> Files.browseFile "/app/frontend" "index.html"
path "/" >=> Files.browseFile "frontend" "index.html"
path "/" >=> Files.sendFile "index.html" true
path "/" >=> Files.file (Files.resolvePath "/app/frontend" "index.html")
path "/" >=> Files.browseFileHome "index.html"
path "/" >=> Files.file "/app/frontend/index.html"

none of them work. I confirmed, the file is at /app/frontend/index.html

Files.file doesn't look in the home folder, but Files.browseFileHome does:

path "/" >=> Files.browseFileHome "index.html"

I agree that the documentation is very fuzzy on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM