0.1.2 • Published 3 years ago

@codealpha/serve-spa v0.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

This module namespaces the Single Page App url's to prevent clashes with existing server url's.

Provide any token such as __REPLACE_BASEURL_HERE__ in the index.html to be replaced with the baseUrl to the SPA router.

<!DOCTYPE html>
<html lang="en">
  <head>
    <link rel="icon" href="__REPLACE_BASEURL_HERE__/favicon.ico" />
  </head>
  <body>
    <script>
      window.base_uri = "__REPLACE_BASEURL_HERE__";
    </script>
  </body>
</html>
    .Router()
    .use(
      "/ui",
      await serveSPA({
        indexPath: __dirname + "/public/index.html",
        publicPath: __dirname + "/public",
        replaceToken: "__REPLACE_BASEURL_HERE__",
      })
    )