@codealpha/serve-spa

0.1.2 • Public • Published

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__",
      })
    )

Readme

Keywords

none

Package Sidebar

Install

npm i @codealpha/serve-spa

Weekly Downloads

1

Version

0.1.2

License

ISC

Unpacked Size

4.95 kB

Total Files

4

Last publish

Collaborators

  • catech