I am unable to serve a website using gin server. Here’s the go code snippet:
router := gin.Default() router.StaticFile("/", "./build/index.html")
and index.html has
<link rel="modulepreload" href="/_app/immutable/pages/index.svelte-6d5b7005.js"/> and some css links too.
Now, the server serves index.html file fine but the js modules aren’t being loaded.
How do I serve the index.html in a way that all the nested files/modules also get served
You have to serve whole directory
But double check if all files from build dir should be available publicly.
Answered By – kuklyy
Answer Checked By – Dawn Plyler (GoLangFix Volunteer)