79117017

Date: 2024-10-23 08:20:45
Score: 1
Natty:
Report link

Answer by @Wickramaranga should be the accepted one, works like a charm and is inbuilt to the current elysia version as of writing this.

 .use(
    staticPlugin({
      prefix: '/subfolder/if/needed/',
      alwaysStatic: true,
      indexHTML: true, // <--
    }),
  )

This way we dont need to have additional route for serving index.html for all routes or base routes, plus all the files are served correctly, in other approaches, if you point * to index.html as route, assets files are also overwritten by the index.html serve logic for some reason.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Wickramaranga
  • Low reputation (1):
Posted by: DeadpooL